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

  1. Launch the VirutalBox software.
  2. To create a new VM, click the New button in the tool bar. This will invoke the wizard for newing a VM.
  3. Name and operating system. You can name anything with the new VM, such as ics. For OS type, choose Linux operating system and Debian (32 bit) version. Then click Next.
  4. Memory size. Just leave the default setting for base memory size (512MB). Click Next.
  5. Hard drive. Leave the default setting (Create a virtual hard drive now). Click Next. This will invoke another wizard for virtual hard drive creation.
    1. Hard drive file type. Choose the VDI file type (default setting). Then click Next.
    2. Storage on physical hard drive. Choose Dynamically allocated (default setting). Click Next.
    3. 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. Click Create.

This will create a new VM as configured.

Loading Debian installation image

  1. Choose the new VM in the VirtualBox Manager, then click the Start button in the tool bar to launch the VM.
  2. 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. Click Devices in the menu bar in the VM window, navigate to CD/DVD Devices, click Choose a virtual CD/DVD disk file..., then select the Debian image file, and relaunch the VM.
  3. After setting the Debian image file correctly, you will see the Debian GNU/Linux installer boot menu. Select Graphical install by keyboard. This will start the installation wizard. If your mouse is captured by the VM, press the right Ctrl key to release the mouse.

Installing Debian in the VM

在select and install software一步出现错误

据同学反应, 安装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安装结束后, 就可以重新连网了.

  1. Select a language. Choose English. NOTE: Do NOT choose Chinese, 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.
  2. Select your location. Choose Other -> Asia -> China.
  3. Configure locales. Just leave the default setting (United States - en_US.UTF-8).
  4. Configure the keyboard. Just leave the default setting (American English).
  5. Configure the network. Just wait.
    • Hostname: Just leave the default setting (debian).
    • Domain name: Just leave the default setting ().
  6. 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.
  7. Configure the clock. Just wait.
  8. 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, choose Manual instead to perform partition configuration manually. Otherwise the existing data will be lost! For more details, click help 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. Select Finish partitioning and write changes to disk and click Continue.
    • Write the changes to disks?: Select Yes.
  9. Install the base system. Just wait.
  10. 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.
  11. Select and install software. Just wait.
    • Configuring popularity-contest: Just select your favor.
    • Software selection: Just leave the default setting (select Standard system utilities).
  12. 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.
  13. Finish the installation. Click Continue.

After finishing the installation, the system will restart.

results matching ""

    No results matching ""