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
- Read the whole text carefully.
- Install software mentioned.
- Install a GNU/Linux VM.
- 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="开始实验后不要对电脑做奇怪的事情!!" %}
历届均出现有学生在开始本实验后对电脑进行一些莫名其妙的操作,导致轻则虚拟机实验环境损坏,重则写过的代码付之一炬,严重影响成绩。所以在此提醒同学们,在开始进行实验后,不要随意调整电脑的配置,下面列举一些可能对电脑产生影响的操作,包括但不限于:
- 对 Windows 进行重装,升级或更新,哪怕是打补丁;
- 安装或卸载一些可能对 Windows 系统环境造成影响的组件或软件,如 Office,Visual Studio 等(当然不是说电脑里面不能有,是指不在实验开始后去安装或卸载,请仔细理解);
- 作死在完成虚拟机配置以后去装双系统等操作;
- 对虚拟机软件进行升级、重装等操作。
{% endpanel %}
Installing Oracle Virtual Box
You may found the latest version of Virtual Box on this page in the website. 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 Box 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 website. 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.
Launch the
Oracle VM VirtualBox Manager
.Click the
New
button on the interface and a guide form will appear to help you complete the process.Name and operating system. You may set any name for the virtual machine, such as
ics
or something. For type, please chooseLinux
. For version, you should choose the one best fits the OS you're installing, here we chooseDebian (32-bit)
. Then clickNext
.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 clickNext
.{% 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 %}
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 clickCreate
.- Hard disk file type. Leave the default selection,
VDI (VirtualBox Disk Image)
and clickNext
. - 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 clickNext
. - 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
.
- Hard disk file type. Leave the default selection,
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
- 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.) - Select
Storage
and then select theEmpty
item with a CD icon below theController: IDE
in the Storage Device panel. Next, click the CD icon in the Attributes panel. - 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. ClickOpen
. - Click
OK
on the bottom of Stroage interface. - 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 theDebian 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 pressingRight Ctrl
. - Select the
Graphical install
using up and down keys on the keyboard, and press Enter.(如果你选择之后无法进入下一步,是因为你们电脑在BIOS里的虚拟化没有开,请根据你电脑的机型查阅相关资料,开启虚拟化) - 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 %}
Select a language. Select
English - English
and clickContinue
. Note that don't select Chinese (Simplified or Traditional) because there's some potential problems while using a Chinese character set based OS.Select your location. Select
other -> Asia -> China
.Configure locales. Just leave the default settings (
United States - en_US.UTF-8
) and clickContinue
.Configure the keyboard. Just leave the default settings (
American English
) and clickContinue
.Load installer components from CD. Just wait.
Configure the network. Just wait for a moment.
- 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. - Network configuration method: Select
Do not configure the network at this time
and clickContinue
. We will configure it in the next section. - Hostname: Leave the default settings (
debian
) and clickcontinue
.
- Network autofiguration failed. We have cut down the network at the beginning, so the installer is unable to detect the network. Click
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 %}
- 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! - 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张三
orwangermazi
for王二麻子
, etc. - Username for your account: just set the same to the user name in the last step.
- 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.
- Root password:
Configure the clock. With no network set, this step will be skipped in a flash.
Partition disks. This step will lead you to partition the disk to use the disk space.
- Partitioning method: Guided - use entire disk.
- Select disk to partition: choose the only disk in the list.
- Partitioning scheme: All files in one partition (recommended for new users).
- Overview: you can see all partitioning information here. Make sure nothing goes wrong and select
Finish partitioning and write changes to disk
then clickContinue
. - Write the changes to disks? Select
Yes
and clickContinue
.
Install the base system. Just wait.
- Scan another CD or DVD? Select
No
and clickContinue
.
- Scan another CD or DVD? Select
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 clickContinue
.
- Continue without a network mirror? Select
Participate in the package usage survey? Any choice will be fine.
Software selection. Make sure the
standard system utilities
is selected and clickContinue
. Then just wait.Install the GRUB boot loader on a hard disk.
- Install the GRUB boot loader to the master boot record? Select
Yes
and clickContinue
. - Device for boot loader installation: Select
/dev/sda
and clickContinue
.
- Install the GRUB boot loader to the master boot record? Select
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.