Installing More Tools

TODO

  1. Read the whole text carefully.
  2. Try the commands of Linux mentioned.
  3. Configure the network if your VM cannot access to the Internet.
  4. Add apt sources to acquire a faster installation.
  5. Install all tools mentioned.
  6. Answer all the questions given in the quoting part.

Configuring the Network

We executed an installation without network, which make it unable to acquire network address by operating system itself so we configure it manually. If your VM can connect to the Internet correctly, you can skip this and navigate to Adding APT sources in this section.

Configuring VM settings

Before booting the VM, we configure the VM itself firstly.

  1. Make sure your VM is not running, select the VM you created in the sidebar and click Settings.

  2. Click Network in the sidebar.

  3. Make sure Enable Network Adapter in Adapter 1 is checked and configure Attached to as Nat.

  4. The Name field will be enabled and what you should do is select the network device (wireless or wired network adapter) you are using.

  5. Click Advanced .

  6. Click Port Forwarding .

  7. Click the green ➕ in the right sidebar,make sure the Host Port and Guest Port is 22 .

  8. Click OK to save the Port Forwarding.

  9. Click OK to save the settings.

Configuring OS Settings

Now start your VM and login as normal user. Check the network with command below:

ping 114.114.114.114 -c 4

In most of circumstances, you will receive a message telling you that:

connect: Network is unreachable

and this means we should also configure the settings of Debian manually.

Execute command

ip addr

and you will see all network adapters in your VM. By default, the first interface is lo which represents the loopback network and what we should focus on is the second one:

2: enp0s3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
	link/ether 08:00:27:a4:55:95 brd ff:ff:ff:ff:ff:ff

If you have only the lo interface, that means you don't turn on the Adapter 1 in the settings of VM properly.

The message you can see might be different, but we just focus on the name of the interface. In this example, it is enp0s3 and you can treat it as the name of the adapter, please remember the one you see and we will use it later.

Type commands below to modify the settings of interfaces, you don't need to type strings following # which mean comments but not parts of a command.

cd /etc/network/
sudo cp interfaces interfaces.bak # make a backup of the setting file
sudo vim interfaces

and then modify the opened file as described below (NOT COPY AND PASTE DIRECTLY). We call this format below diff formatopen in new window and you can also search the Internet to learn more about it.

--- before modification
+++ after modification
@@ -?,3 +?,6 @@
 # The loopback network interface
 auto lo
 iface lo inet loopback
+
+auto enp0s3
+iface enp0s3 inet dhcp

but please replace enp0s3 with your own name of interface which might be different. Save the file and execute

sudo service networking restart

and wait a minute. When this command is executed correctly, you can execute

ip addr

again and you will find that the interface enp0s3 is allocated with an IP address which usually looks like 192.168.x.x or something but if you can access to the Internet, it makes no difference.

Now we let's check if the network working normally by

ping www.baidu.com -c 4

and if you see message below, it means your network is running correctly:

PING www.a.shifen.com (180.97.33.107) 56(84) bytes of data.
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=1 ttl=55 time=37.1 ms
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=2 ttl=55 time=37.7 ms
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=3 ttl=55 time=37.7 ms
64 bytes from 180.97.33.107 (180.97.33.107): icmp_seq=4 ttl=55 time=37.5 ms

--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 17063ms
rtt min/avg/max/mdev = 37.183/37.557/37.762/0.302 ms

Adding APT sources

Because of the network environment, we should replace the original ones with others in the mainland of China, so you should perform modification below:

cd /etc/apt/                          # change to the directory setting file exists
sudo cp sources.list sources.list.bak # make a backup of the setting file
sudo vim sources.list

What you should do is to comment out each line existing now with a # symbol at the start of this line like:

# deb cdrom:[Debian GNU/Linux 9.6.0 _Stretch_ - Official i386 NETINST 20181110-12:18]/ stretch main
# something...
# something...
# ...

and then append lines below at the end of the file, please make sure you don't type any letter with the wrong one:

deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

make sure you didn't type anything wrong and save it by <Esc>:wq to save and exit vim.

Now update the apt source by

sudo apt update
sudo apt upgrade -y

This command requires root permission, too. And it requires Internet accessing. It costs some time for this command to finish. If some errors are reported, please check

  • whether there are any typos in sources.list, and
  • whether your host is able to access the Internet.

Installing tools for PAs

The following tools are necessary for PAs, and you don't need to type the comment part:

sudo apt install man                # online reference manuals
sudo apt install build-essential    # build-essential packages, include binary utilities, gcc, make, and so on
sudo apt install gcc-doc            # GCC document
sudo apt install gdb                # GNU debugger
sudo apt install git                # reversion control system
sudo apt install gcc-multilib       # a library to use compile the project later
sudo apt install libreadline-dev    # a library to use compile the project later
sudo apt install libsdl2-dev        # a library to use compile the project later
sudo apt install qemu-system-x86    # QEMU

If you want do install them quickly, you can use:

sudo apt install man build-essential gcc-doc gdb git gcc-multilib libreadline-dev libsdl2-dev qemu-system-x86 -y

to install all of them.

Tools installed above will be discussed in the next section.


That's everything in PA0.4.

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