Although I used to be an RA at CUHK, it still cost me nearly two weeks to setup everything on my desktop. Here is the recording.

Why Gentoo?

I have used Arch Linux on my laptop for more than 2 years. Arch Linux is a perfect Linux distros, except its stability, which always leads to annoying problems. Even now when I try to shutdown my laptop, the screen will freeze so I have to hold the power button to force a shutdown.
Gentoo, on the contrary, is a great choice for me. Moreover, my office has 24h electricity supply; my desktop has a powerful 4-core Xeon CPU. Anyway, long-time compilation is acceptable.

Choose the right installation medium

The official Minimal CDs are incapable of booting in UEFI mode. They boot in BIOS (MBR) mode only. If you want to make your system UEFI bootable, you must download the Hybrid ISO (LiveDVD).
For me, another advantage of using LiveDVD is that it contains many nice wallpapers.

Network configuration

Every desktop in CSE department uses static IP address. However, the Gentoo Installation Guide doesn’t provide enough information about the configuration for static addresses. A useful document is here: Gentoo Linux x86 Handbook: Network configuration

Proxy configuration

According to ANSR Lab Wiki, I can get access to the Internet. But I can’t use ping, ssh, ftp and git clone over Git protocol.
As far as I know, all of these problems are insoluble. However, we can use this command to rewrite the default protocol of Github:

1
git config --global url.https://github.com/.insteadOf git://github.com/

And set the proxy of git:

1
2
git config --global http.proxy http://proxy.cse.cuhk.edu.hk:8000
git config --global https.proxy https://proxy.cse.cuhk.edu.hk:8000

Printer configuration

The printer in my office is a Windows printer via SAMBA, so the first thing is to install samba and the HP printer driver hplip.
For Arch Linux and Gentoo, you can install system-config-printer. Its GUI is similar to System Settings -> Printers on Ubuntu.
If you don’t set your search domain, the printer address should be smb://NTSVR6.cse.cuhk.edu.hk/lp120. Or you can set your search domain by adding the following line in /etc/resolv.conf

1
search cse.cuhk.edu.hk

The most important thing is that you have to change your password upon first login. You need a Windows PC in CSE department. Log in with your initial password, and the system will return a message saying that you need to change your password. Then click “OK” button (Do NOT click “Cancel”!) and you can input your new password.

Unix access

You can use ssh to connect to the Unix/Linux servers in CSE department. For example:

1
2
# if you've set the search domain, you can omit ".cse.cuhk.edu.hk"

To change your password, use yppasswd command. Somehow, I can’t change my password on linux1 with the following error:

1
2
No such map
yppasswd: unknown user (uid=4960).

Jack Lee told me to try solar1 and problem solved.

Personal website

After you connect to a Unix/Linux server, create a directory named www in your home directory. Now you can upload your personal website in it. Note that you need to set permission at least 755:

1
chmod -R 755 www

Use WiFi on my desktop

As I mentioned above, many ports have been disabled by our department. Therefore, I can’t use ssh, ftp and so on. It’s very disgusting, you will find yourself be magically blocked from time to time.
Luckily, I have a 360 WiFi version 2, a wireless USB adapter. Current Linux kernel (4.9.34) contains its driver. You can find it at /sys/module/mt7601u/.

1
2
3
4
5
6
# load the module
modprobe mt7601u
# find the interface of wireless network, for me, it's wlp0s20u14
ip link
# activate the network interface
ip link set wlp0s20u14 up

By default, Gentoo uses netifrc to control network interfaces, but I can’t utilize it for both Ethernet and WiFi because they have different DNS, search domain, etc. So I installed networkmanager and nm-applet to manage them. Don’t forget to remove existing netifrc scripts from controlling network interfaces, see the wiki
Note that when you use WiFi, you need to disable your proxy settings:

1
2
3
4
5
6
unset http_proxy
unset https_proxy
unset ftp_proxy
unset rsync_proxy
unset socks_proxy
unset no_proxy