PA0 is a guide to GNU/Linux development environment configuration. You are guided to install a GNU/Linux VM (virtual machine). All PAs and Labs are done in this environment. If you are new to GNU/Linux, and you encounter some troubles during the configuration, which are not mentioned in this lecture note (such as "No such file or directory"), that is your fault. Go back to read the lecture note carefully. Remember, the machine is always right!
If you already have one copy of GNU/Linux, and you want to use your copy as the development environment, just use it! But if you encounter some troubles because of different GNU/Linux distribution or different version of the same distribution, please search the Internet for trouble-shooting.
Installing VirtualBox
Download VirtualBox from this website according to your host operating system, then install VirtualBox. Note that if your host is GNU/Linux, you can install VirtualBox by
apt-get install virtualbox
in Ubuntu or Debian. Different distribution uses different package tools. Please search the Internet for more information.
You can use other virtualization softwares (such as VMware) instead of VirtualBox. Also, if you have troubles about VMware or other virtualization softwares, please search the Internet.
Installing a GNU/Linux VM
We choose the Debian distribution for the VM(virtual machine), since it can be quite small.
Getting Debian
You can get the newest stable version of Debian here. For our experiment, we use the netinst CD image with i386 architecture. Click the link label with i386
in the netinst CD image
category to download the image.
Creating a VM
- Launch the VirutalBox software.
- To create a new VM, click the
New
button in the tool bar. This will invoke the wizard for newing a VM. - Name and operating system. You can name anything with the new VM, such as
ics
. For OS type, chooseLinux
operating system andDebian (32 bit)
version. Then clickNext
. - Memory size. Just leave the default setting for base memory size (
512MB
). ClickNext
. - Hard drive. Leave the default setting (
Create a virtual hard drive now
). ClickNext
. This will invoke another wizard for virtual hard drive creation.- Hard drive file type. Choose the VDI file type (default setting). Then click
Next
. - Storage on physical hard drive. Choose
Dynamically allocated
(default setting). ClickNext
. - File location and size. Just leave the default settings (with size of 8GB). If you want to modify the location of the virtual disk file, choose another path as you wish. But do NOT choose a path with Chinese character (such as
D:\我的虚拟机
), else VirtualBox may not recognize the path correctly. ClickCreate
.
- Hard drive file type. Choose the VDI file type (default setting). Then click
This will create a new VM as configured.
Loading Debian installation image
- Choose the new VM in the VirtualBox Manager, then click the
Start
button in the tool bar to launch the VM. - If you launch the VM for the first time, a wizard will be invoked. Select the Debian image file you have downloaded as the media source. If you miss the first run wizard by mistake (such as clicking the
Cancel
button), don't worry. ClickDevices
in the menu bar in the VM window, navigate toCD/DVD Devices
, clickChoose a virtual CD/DVD disk file...
, then select the Debian image file, and relaunch the VM. - After setting the Debian image file correctly, you will see the
Debian GNU/Linux installer boot menu
. SelectGraphical install
by keyboard. This will start the installation wizard. If your mouse is captured by the VM, press theright Ctrl
key to release the mouse.
Installing Debian in the VM
据同学反应, 安装debian时会在select and install software一步出现如下错误:
An installation step failed. You can try to run the failing item again from the menu, or skip it and choose something else. The failing step is : Select and install software
有同学猜测可能是由于近期阅兵导致大批镜像网站停止服务,因此安装失败率极高, 并建议大家在安装debian前先断网, 例如拔网线, 不登陆p.nju等. 这样VM就无法访问Internet了, 从而不会因为尝试从镜像网站获取信息而失败. 但断网之后, 安装过程中会遇到类似"无法连接网络"的提示, 你可以忽略这些提示, 在断网状态下继续安装. debian安装结束后, 就可以重新连网了.
- Select a language. Choose
English
. NOTE: Do NOT chooseChinese
, because it may lead to some unnecessary issues, such as switching input method back and forth, and some encoding troubles. Remember, in all experiments, Chinese environment is unnecessary. - Select your location. Choose
Other
->Asia
->China
. - Configure locales. Just leave the default setting (
United States - en_US.UTF-8
). - Configure the keyboard. Just leave the default setting (
American English
). - Configure the network. Just wait.
- Hostname: Just leave the default setting (
debian
). - Domain name: Just leave the default setting ().
- Hostname: Just leave the default setting (
- Set up users and passwords. Since the VM is only for experimental usage, you do not need to set up complex passwords.
- Root password: The root account is very important. If you forget the root password, you can not fully control the operating system.
- Full name for the new user: Anything will be fine.
- Username for your account: Anything will be fine, too. But pay attention to the restriction.
- Choose a password for the new user: This password is different from the root's one, because they belong to different accounts. Again, a simple password will be fine.
- Configure the clock. Just wait.
- Partition disks. This step will perform disk partitioning.
- Partitioning method: Choose
Guided - use entire disk
. If you are installing GNU/Linux in the host machine, and there are data in some partitions, chooseManual
instead to perform partition configuration manually. Otherwise the existing data will be lost! For more details, clickhelp
or search the Internet. - Select disk to partition: You only have one disk, the virtual disk you created before, to select.
- Partition scheme: Choose
All files in one partition
. - Overview: The guided partitioning method will configure the virtual disk into two partitions, one for the ext4 file system, whose mount point is set to the root of file system (labeled with
/
), the other for the swap area. SelectFinish partitioning and write changes to disk
and clickContinue
. - Write the changes to disks?: Select
Yes
.
- Partitioning method: Choose
- Install the base system. Just wait.
- Configure the package manager
- Debian archive mirror country: The installation guide is going to download and install packages from the Internet, which is unnecessary for the experiment. Under a poor network environment, this may cost a long time. Click
Go Back
. - Continue without a network mirror: Select
Yes
.
- Debian archive mirror country: The installation guide is going to download and install packages from the Internet, which is unnecessary for the experiment. Under a poor network environment, this may cost a long time. Click
- Select and install software. Just wait.
- Configuring popularity-contest: Just select your favor.
- Software selection: Just leave the default setting (select
Standard system utilities
).
- Install the GRUB boot loader on a hard disk
- Install the GRUB boot loader to the master boot record?: Choose
Yes
. - Device for boot loader installation: Select
/dev/sda
.
- Install the GRUB boot loader to the master boot record?: Choose
- Finish the installation. Click
Continue
.
After finishing the installation, the system will restart.