Installing a GNU/Linux VM

PA0 is designed to help you to set up a complete environment for the following PAs. Firstly, a virtual machine is necessary to deal with all PAs and Labs in this term. So you are supposed to install it CAREFULLY and make sure you had set up everything mentioned in the text.

TODO

  1. Read the whole text carefully.
  2. Install software mentioned.
  3. Install a GNU/Linux VM.
  4. Answer all the questions given.

For GNU/Linux Users

It is not necessary for you to install a VM in your system, for the reason that our experiments are based on the GNU/Linux, you may skip this section.

Using GNU/Linux out of VMs (Not Necessary)

It is strongly recommended for you to install a GNU/Linux system in your computer, existing with the other systems (e.g., Windows) installed already, to acquire the maximum running efficiency of your computer. But this seems too complex for you, so we just tell you this but not provide more information. If you're interested, you may search the Internet. If you had done that, you may get more scores in this part PA0.

Note that if you had done this, you need also write a report, read all of the remaining text and complete all practices in PA0. However, you don't need to perform operations related to OS itself but to install the required tools and environment.

FBI WARNING

As you started doing PAs and labs, please DO NOT CHANGE ANYTHING in your operating systems (such as upgrading, re-installing your os, changing some key settings) or you might be suffering from a disease that you will LOST EVERYTHING you had done to the VM, or more seriously, your code.

{% panel style="danger", title="开始实验后不要对电脑做奇怪的事情!!" %}

历届均出现有学生在开始本实验后对电脑进行一些莫名其妙的操作,导致轻则虚拟机实验环境损坏,重则写过的代码付之一炬,严重影响成绩。所以在此提醒同学们,在开始进行实验后,不要随意调整电脑的配置,下面列举一些可能对电脑产生影响的操作,包括但不限于:

  1. 对 Windows 进行重装,升级或更新,哪怕是打补丁;
  2. 安装或卸载一些可能对 Windows 系统环境造成影响的组件或软件,如 Office,Visual Studio 等(当然不是说电脑里面不能有,是指不在实验开始后去安装或卸载,请仔细理解);
  3. 作死在完成虚拟机配置以后去装双系统等操作;
  4. 对虚拟机软件进行升级、重装等操作。

{% endpanel %}

Installing Oracle Virtual Box

You may found the latest version of Virtual Box on this page in the websiteopen in new window. If you are Windows user, please download the Windows hosts and install it. If you are using a mac with OS X system, please download the OS X hosts then install it. If you had chosen to use a Linux system on the physical machine, this section may be skipped.

If you have trouble installing it to your computer, please take a look at the online manual of Oracle Virtual Boxopen in new window before asking others.

WARNING

It is not recommended for you to use a VPS (or ECS like Aliyun, Tencent Cloud, etc.) to do experiments because the way a VPS run (which usually runs in a container rather than on real hardware environment) is not the same as a virtual machine (which runs in the virtualized hardware environment) and you might encounter with some unknown problems when you doing your experiments. What's more, servers are designed to deploy projects rather than developing projects so it is not wise to use it.

{% panel style="warning", title="不要使用云服务器做实验!" %}

请不要使用阿里云、腾讯云等 VPS(或 ECS)进行实验,因为这些云服务器的底层实现和虚拟机并不相同,服务器适用于部署项目而不是开发项目。使用云服务器做实验可能会导致部分命令参数不同,或者系统不兼容实验环境等问题。

{% endpanel %}

Getting a GNU/Linux package

Only Debian and Ubuntu systems are supported in our experiments and you should choose Debian as your environment in most circumstances to avoid unknown problems. So don't try to use other Linux systems (such as CentOS, Red Hat) to do experiments, not for the reason that it's unable to use, but you will encounter with unknown problems running PAs and labs.

{% panel style="success", title="Linux and Linux?" %}

Debian and Ubuntu, even CentOS and Red Hat mentioned above are all different kinds of Linux. What are the common and different points betweent them? Please search the Internet and answer this.

{% endpanel %}

You may get the latest version of Debian here on the official websiteopen in new window. But we recommend you to use a mirror source in the mainland of China, for some reasons you might be already aware of. You may download one in the following mirror list. The name of the file you should download looks like debian-?.?.?-i386-netinst.iso, the ? is varied with the update of new versions.

Netease Mirror:

http://mirrors.163.com/debian-cd/current/i386/iso-cd/

Aliyun Mirror:

http://mirrors.aliyun.com/debian-cd/current/i386/iso-cd/

{% panel style="danger", title="Only 32-bit envirnoment is accepted" %}

Note that wherever you download the package from, please choose the 32-bit version (or you may see i386 version on the website). If you install a 64-bit version (the same meaning of amd64), you will be unable to complete labs later. It's the same if you are trying to download Ubuntu as your experiment environment although we don't hope you to do that. By the way, Ubuntu is now not providing 32-bit versions after Ubuntu 16.04.

{% endpanel %}

Creating a Virtual Machine

Now we will create a new virtual machine, and what you should do is to read text below carefully and operate without skipping any step or you may fail to install it. From this part, we will install a Debian 9.6.0 VM for example.

  1. Launch the Oracle VM VirtualBox Manager.

  2. Click the New button on the interface and a guide form will appear to help you complete the process.

  3. Name and operating system. You may set any name for the virtual machine, such as ics or something. For type, please choose Linux. For version, you should choose the one best fits the OS you're installing, here we choose Debian (32-bit). Then click Next.

  4. Memory size. Just leaving the default size is okay, but we recommend you to set an value not less than 1024MB or you may feel that the machine is running slowly. Then click Next.

    {% panel style="success", title="Can't memory be larger?" %}

    Can the size of memory be as large as possible? There's a limitation of 4GB for 32-bit operating systems, why? (Hint: Architecture and addressing)

    {% endpanel %}

  5. Hard disk. Choose Create a virtual hard disk now to create a hard disk for the VM or there will be no space available to install OS in. Then click Create.

    1. Hard disk file type. Leave the default selection, VDI (VirtualBox Disk Image) and click Next.
    2. Storage on physical hard disk. This step will set the type VirtualBox allocate the image file. Leave the default selection, Dynamically allocated. In this way, it will not occupy too much space on your physical disk. Then click Next.
    3. File location and size. This step will set where the image file is stored and the maximum size of it. Just leaving the default settings is okay, but you may name it as you want. Note that don't choose a path which includes non-English characters (e.g. D:\虚拟机, E:\ics*disk, etc.). For size, 8GB is enough. Then click Create.

Now you can see a new virtual machine on the sidebar. If you try to run the VM now, you may get a message that telling you there's no bootable medium found.

Installing Operating System on the VM

In this section, we will lead you to install Debian on the newly created VM.

Load Debian Installation Image

  1. Select the newly created VM on the sidebar, and choose Settings on the toolbar. (If you feel the window is too small, you can click View in the menu bar click Virtual Screen 1 and select a suitable one.)
  2. Select Storage and then select the Empty item with a CD icon below the Controller: IDE in the Storage Device panel. Next, click the CD icon in the Attributes panel.
  3. Click Choose Virtual Optical Disk File... and a form will appear to allow you choose the image file. Just navigate to the folder you save the image file downloaded before and select the image file (.iso format) you downloaded. Click Open.
  4. Click OK on the bottom of Stroage interface.
  5. Now select the VM just created on the sidebar and click Start on the toolbar. If every step in this section is done correctly, you will see the Debian GNU/Linux installer boot menu on the screen of the VM. Note that if your pointer is captured by the VM, you may release it by pressing Right Ctrl.
  6. Select the Graphical install using up and down keys on the keyboard, and press Enter.(如果你选择之后无法进入下一步,是因为你们电脑在BIOS里的虚拟化没有开,请根据你电脑的机型查阅相关资料,开启虚拟化)
  7. You will see the Select a language on the screen and the following steps will be described in the next section.

Installing Debian in the VM

AT FIRST, please CUT DOWN THE INTERNET CONNECTION of VM or you will spend much time waiting for the updates! To cut down the connection, please right click the icon which seems like two screens on the right bottom of the status bar then click Connect Network Adapter and you will see the icon become disabled.

{% panel style="warning", title="在断网环境下安装" %}

因为国内网络环境不佳,安装程序会自动连接到国外的下载点下载一些不必要的更新,然而这个连接有时不能正常建立,这样以来就会花费很多时间反复进行很多失败的网络请求,导致正常的安装流程阻塞,耽误同学们的宝贵时间,所以请务必先断网,再继续本节的安装过程!虽然这样的安装流程将导致首次开机没有网络,但是我们会带领同学们解决该问题。

经实际测试,不断网安装在网络条件较好时可行。但是这非常依赖你目前所处于的网络环境,有较强的运气成分,不能保证每个人都能在有网环境下顺利安装(提示:网络环境≠下载速度≠网络延迟)。此外,若尝试联网安装,进行到安装组件时,务必取消勾选安装,否则整个安装进度必被卡死。

另外,联网安装的同学,除了位于这里Configuring the Network 因为网络环境正常可以跳过以外,其余所有 PA0 的步骤都不可以跳过。

{% endpanel %}

  1. Select a language. Select English - English and click Continue. Note that don't select Chinese (Simplified or Traditional) because there's some potential problems while using a Chinese character set based OS.

  2. Select your location. Select other -> Asia -> China.

  3. Configure locales. Just leave the default settings (United States - en_US.UTF-8) and click Continue.

  4. Configure the keyboard. Just leave the default settings (American English) and click Continue.

  5. Load installer components from CD. Just wait.

  6. Configure the network. Just wait for a moment.

    1. Network autofiguration failed. We have cut down the network at the beginning, so the installer is unable to detect the network. Click Continue, regardless of the warning message.
    2. Network configuration method: Select Do not configure the network at this time and click Continue. We will configure it in the next section.
    3. Hostname: Leave the default settings (debian) and click continue.
  7. Set up users and passwords. Here we are going to create accounts of the system, it's normally recommended to set complex passwords but here we don't force you to do that for we are just for experimental usage.

    {% panel style="danger", title="使用真名汉语拼音作为用户名" %}

    为了保证大家的实验是自己独立完成,我们要求大家使用自己真名的汉语拼音作为非 root 用户的用户名进行实验,并在实验报告中出现的截图中加以体现。如果有同学是本来就使用 Linux 操作系统作为桌面,可以新建一个满足上述要求的用户名的新用户进行实验。

    {% endpanel %}

    1. Root password: Root account is a very important in the system, please keep the password you set in your mind all the time or you will be unable to do most of things in the future!
    2. Full name for the new user: to trace the process of the experiment, we make an agreement that your username should be set as your own real name. For example, zhangsan for 张三 or wangermazi for 王二麻子, etc.
    3. Username for your account: just set the same to the user name in the last step.
    4. Choose a password for the new user: this password is the one for the non-root user we created just now. A simple password will be fine.
  8. Configure the clock. With no network set, this step will be skipped in a flash.

  9. Partition disks. This step will lead you to partition the disk to use the disk space.

    1. Partitioning method: Guided - use entire disk.
    2. Select disk to partition: choose the only disk in the list.
    3. Partitioning scheme: All files in one partition (recommended for new users).
    4. Overview: you can see all partitioning information here. Make sure nothing goes wrong and select Finish partitioning and write changes to disk then click Continue.
    5. Write the changes to disks? Select Yes and click Continue.
  10. Install the base system. Just wait.

    • Scan another CD or DVD? Select No and click Continue.
  11. Configure the package manager. We don't need to use the mirrors provided for network issues, we will configure it in the future so do the following steps:

    • Continue without a network mirror? Select Yes and click Continue.
  12. Participate in the package usage survey? Any choice will be fine.

  13. Software selection. Make sure the standard system utilities is selected and click Continue. Then just wait.

  14. Install the GRUB boot loader on a hard disk.

    1. Install the GRUB boot loader to the master boot record? Select Yes and click Continue.
    2. Device for boot loader installation: Select /dev/sda and click Continue.
  15. Finish the installation. Congratulations! You've installed Debian successfully. Before clicking Continue to reboot the VM, you should check items below:

    • Don't forget to turn on the network connection.
    • Make sure the CD is removed. The installer might remove it automatically, but you should check whether or not at the right bottom of the status bar where there's a CD icon.

Don't touch the keyboard when the GRUB interface appears and the system will boot by itself until you see the prompt:

Debian GNU/Linux 9 debian tty1

debian login:_

This means the installation is successful and we will guide you to explore it in the next section.


That's everything in PA0.1.

Last Updated 2023-04-02 14:55:00