用u盘安装ubuntu

用u盘安装ubuntu,准备一个大一点的u盘,安装完了以后的一些调整和优化

原文
http://www.ubuntu.com/download/ubuntu/download-zh

Download the desired file
Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)
Convert the .iso file to .img using the convert option of hdiutil (e.g., hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso)
Note: OS X tends to put the .dmg ending on the output file automatically.
Run diskutil list to get the current list of devices
Insert your flash media
Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)
Execute sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).
Using /dev/rdisk instead of /dev/disk may be faster.
If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the 'Disk Utility.app' and unmount (don't eject) the drive.
Run diskutil eject /dev/diskN and remove your flash media when the command completes
Restart your Mac and press alt while the Mac is restarting to choose the USB-Stick

1
hdiutil convert -format UDRW -o ~/Downloads/ubuntu-11.10-desktop-i386.img ~/Downloads/soft/os/ubuntu-11.10-desktop-i386.iso
2
ohergal@ohergal_osx1 ~/Downloads/tmp $ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 499.2 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *8.1 GB disk1
1: EFI 209.7 MB disk1s1
2: Apple_HFS osx_sony8gb 7.8 GB disk1s2
3
$ diskutil unmountDisk /dev/disk1
4
$ sudo dd if=~/Downloads/ubuntu-11.10-desktop-i386.img.dmg of=/dev/disk1 bs=1m

$ eject /dev/disk1

$ hdiutil convert -format UDRW -o ~/Downloads/tmp/FreeBSD-8.2-RELEASE-amd64-all/FreeBSD-8.2-RELEASE-amd64-dvd1.img /Volumes/Untitled/backup/bak/OS/bsd/FreeBSD-8.2-RELEASE-amd64-all/FreeBSD-8.2-RELEASE-amd64-dvd1.iso

sudo dd if=~/Downloads/tmp/FreeBSD-8.2-RELEASE-amd64-all/FreeBSD-8.2-RELEASE-amd64-dvd1.img.dmg of=/dev/disk1 bs=1m

http://my.oschina.net/alphajay/blog/28783

安装完的第一件事是去/etc/default/locate
里修改LANG="zh_CN.UTF-8"
然后重启登陆
然后安装sshd
$ apt-get install openssh-server
开机启动配置工具
$ apt-get install rcconf
这个也可以
$ sudo apt-get install sysv-rc-conf
下面这个也可以 这个貌似是桌面版的
$ sudo apt-get install bum
$ bum
安装emacs
$ sudo apt-get install emacs

安装了桌面
$ apt-get install ubuntu-desktop
设置了开机不启动
$ emacs /etc/X11/default-display-manager
修改为
#/usr/sbin/gdm
false

安装了vnc
$ apt-get install vnc4server
然后vncpasswd
然后修改xstartup
最后面加上gnome-session &
然后启动vncserver

安装了mysql
$ apt-get install mysql-server

' ubuntu系统修改IP地址:
$ sudo gedit /etc/network/interfaces
auto eth0
iface eth0 inet static
address 219.218.122.168
netmask 255.255.255.0
gateway 219.218.122.254

' 开机不启动x
1 原来要想默认不进入xwindows,只需编辑文件”/etc/default/grub”,
2 把 GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
3 改成GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash text”
4 (即在GRUB_CMDLINE_LINUX_DEFAULT项的后面加上” text”),
5 然后再运行”sudo update-grub”即可。

initctl list即可列出所有服务的运行状态
参考
http://upstart.ubuntu.com/getting-started.html
http://upstart.ubuntu.com/cookbook/
http://shao-fan.com/blog/ubuntu-upstart.html

现在要取消服务就到/etc/init/xxx.conf里去修改
比如mysql的
修改为
#start on (net-device-up
# and local-filesystems
# and runlevel [2345])
stop on runlevel [016]