Installing Tools

In GNU/Linux, you can download and install a software by one command (which may be difficult to do in Windows). This is achieved by the package manager. Different GNU/Linux distribution has different package manager. In Ubuntu, the package manager is called apt.

You will download and install some tools needed for the PAs from the network mirrors. Before using the network mirrors, you should check whether the system can access the Internet.

Checking network state

Inside NJU, you should easily obtain an IPv6 address. To test this, try to ping a mirror host with IPv6 support:

ping -c 4

You should receive reply packets successfully:

PING (2402:f000:1:408:8100::1)) 56 bytes of data.
64 bytes from 2402:f000:1:408:8100::1 (2402:f000:1:408:8100::1): icmp_seq=1 ttl=54 time=1.56 ms
64 bytes from 2402:f000:1:408:8100::1 (2402:f000:1:408:8100::1): icmp_seq=2 ttl=54 time=1.07 ms
64 bytes from 2402:f000:1:408:8100::1 (2402:f000:1:408:8100::1): icmp_seq=3 ttl=54 time=1.07 ms
64 bytes from 2402:f000:1:408:8100::1 (2402:f000:1:408:8100::1): icmp_seq=4 ttl=54 time=1.24 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 7ms
rtt min/avg/max/mdev = 1.071/1.237/1.563/0.203 ms

If you do not have an IPv6 address, you may access the Internet by IPv4 address. You can try to ping a host outside the university LAN:

ping -c 4

If you can ping Baidu successfully, you should successfully ping the mirror host above, too.

Setting APT source file

If your system is not Ubuntu 22.04, please change to a suitable source

Using a source that doesn't match your system will result in a conflicting version of the toolkit, and forcing the installation will damage your system. If you are using a system other than Ubuntu 22.04, please do not use the following sources, you need to search for appropriate sources and replace them.

Run the following commands to update the APT source file:

bash -c 'echo "deb jammy main restricted universe multiverse" > /etc/apt/sources.list'

However, you will receive an error message:

bash: /etc/apt/sources.list: Permission denied

This is because the APT source file is owned by root, and you do not have the permission to modify it.

One solution is first switching to the root account. But to avoid switching, an alternative way is to use sudo. If you find an operation requires superuser permission, append sudo before that operation. Before using sudo, you should add your account to the sudo group. But first, you still need to switch to the root account.

su -

Enter the root password you set during the installation. Note that the password is not shown in the terminal to avoid password leaks. If the password is correct, you will see the prompt changes:


The last character is #, instead of $ before you executing su -. # is the indicator of root account. Now you can add your account to the sudo group.

adduser username sudo  # Change `username` to your user name

To let the changes to take effect, you should log out or reboot. After that, try

sudo whoami

If it is the first time you run sudo, enter the password of your account. You should find that sudo whoami will output root.

Now you can use sudo to modify the APT source file. This time you should modify it successfully. To check this, you can output the file:

cat /etc/apt/sources.list

You should see it really outputs the line you just echoed.

Updating APT package information

Now you can tell apt to retrieve software information from the sources:

apt-get update

However, you will receive an error message:

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/

This is because apt-get requires superuser privilege to run. Run the command with superuser privilege. Since it requires Internet accessing, it may cost some time to finish.

Unmet dependencies issues

If you see problems with Unmet dependencies when running apt-get update, try replacing the above Ali sources with Tsinghua sources:

bash -c 'echo "deb jammy main restricted universe multiverse" > /etc/apt/sources.list'

Then re-run apt-get update.

If the problem persists, try searching the internet and changing to another source.

Installing tools for PAs

The following tools are necessary for PAs:

apt-get install build-essential    # build-essential packages, include binary utilities, gcc, make, and so on
apt-get install man                # on-line reference manual
apt-get install gcc-doc            # on-line reference manual for gcc
apt-get install gdb                # GNU debugger
apt-get install git                # revision control system
apt-get install libreadline-dev    # a library used later
apt-get install libsdl2-dev        # a library used later
apt-get install llvm llvm-dev      # llvm project, which contains libraries used later
apt-get install llvm-11 llvm-11-dev # only for ubuntu20.04

The usage of these tools is explained later.

Installing Chinese input method

Search the Internet for how to install a Chinese input method in Ubuntu.