Install Shadowsocks Qt5 on Debian8.7.1

Yesterday my dear friend xuansu recommended me to give Debian a TRY. He told me: “It’s quite stable and has been running without even a mistake for months. It’s based on GNOME and it’s quite awesome and cool! It’s my primary system now!” And he used to told me that Debian possesses the best package management tool. That’s why I switch my development environment to Debian 8.7.1.

Download Latest Debian Distribution

I get the latest installation CD file from here[1] due to the best way to download a Linux Distribution is from a Open Mirror, as you know China’s network is quite poor, especially for the exportation. The alike well-known mirrors are TUNA (From Tsinghua University), We(From Neusoft) etc.

Installation

My Production Environment is OS X El Capitan(10.11). I can tell you that under this OS no other softwares could be called the most powerful Virtual Machine except Parallels Desktop(As Vmware Workstation is too complex and Virtual Box is too unstable). Just Load the ISO file and choose Graphical Install and follow the prompts(Quite easy to guess what to choose, if there are more than two choices, just choose the first one. If you are not convinced if do so is right, just Google it) to install the Debian 8.7.1.

Install Parallels Desktop Tools

As my software is not up-to-date(PD v.11 not v.12 or maybe v.12 cannot), the system is not completely installed(Can handle graphical processing well, e.g. auto scale the window’s resolution, animation effects, file sharing and etc.). The reason is the newly installed system has not been installed Parallels Tools(As most OS installed, they will not install this tool automatically, except Ubuntu 14.04 LTS and the problem can be solved by installing this tool).

When the system is running, find and click Actions->Install Parallels Tools on the menubar and then enter the system, ignore all the prompts(e.g. open the archive location, playing or so on). Fire terminal, then we need enter some commands.

1
2
3
4
5
6
su
apt-get clean
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
apt-get install linux-headers-$(uname -r) make gcc dkms kpartx -y

These commands are for updating the dependencies, to ensure the PT works properly. If you just finish installing the system, when you enter apt-get <command> you will get an error about can not get the lock. It means the system is updating your system in the background, you just have to sit back and wait for no more than 30 minutes and reboot.

Then we need some other commands to tell the system where to find the tool and whether to install.

1
2
3
4
5
mkdir /home/<username>/Documents/pt
cp -r /media/cdrom0 /home/<username>/Documents/pt
chmod -R 777 /home/<username>/Documents/pt
cd /home/<username>/Documents/pt/cdrom0
./install

(Assuming you will not exit the super user)

After that, there will be a prompt interface asking for your confirmation if you truly want to install this software. Choose next and enter. Then you just need to wait and enter reboot. After rebooting, voila, you can find the differences between now and before. The details can be found here[2].

Common Settings

1
2
3
sudo apt-get install vim -y
sudo apt-get intall apt-transport-https
sudo mv /etc/apt/sources.list /etc/apt/sources/list.bak

To get a good network environment , we need to change the sources list to the servers which is nearest to our location, in this case we choose Tsinghua University’s TUNA Mirror. Use sudo vi /etc/apt/sources.list and add such contents:

1
2
3
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ jessie/updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ jessie main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ jessie-updates main contrib non-free

Add User Into Sudo Group

Fire terminal and then use su to switch to super user, then enter usermod -aG sudo <username> and vi /etc/sudoers and find

1
#User privilege specificationroot ALL=(ALL:ALL) ALL

After <root…> this line, just insert a line <username> ALL=(ALL:ALL) ALL. Then, you can switch to normal user to check: sudo ls, enter your normal user’s password, if there’s no error, that means you have grant the user the privilege of sudo. However, remember:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
We trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility.
### Install Shadowsocks-Qt5
#### Install libQtShadowsocks
From here[^libqtshadowsocks] you can download the latest version(As the project hasn't been updated for almost two years, you can use the following commands to download and install)[^libqtshadowsocks-install].
```bash
cd ~/Documents/
wget https://github.com/shadowsocks/libQtShadowsocks/archive/v1.10.0.tar.gz
tar zxvf v1.10.0.tar.gz
cd libQtShadowsocks-1.10.0/
sudo apt-get install qt5-qmake qtbase5-dev libbotan1.10-dev dpkg-dev debhelper pkg-config -y
dpkg-buildpackage -us -uc -b
cd ..
sudo dpkg -i *.deb
rm -rf *.deb lib* v1.10.0.tar.gz

Install Shadowsocks-Qt5

From here[3] you can download the latest version(Also, you can easily use the following commands as the project is hosted on Github, the url is almost impossible to go wrong)[4].

1
2
3
4
5
6
7
8
wget https://github.com/shadowsocks/shadowsocks-qt5/archive/v2.8.0.tar.gz
tar zxvf v2.8.0.tar.gz
cd shadowsocks-qt5-2.8.0/
sudo apt-get install qt5-qmake qtbase5-dev libqrencode-dev libappindicator-dev libzbar-dev libbotan1.10-dev -y
dpkg-buildpackage -uc -us -b
cd ..
sudo dpkg -i *.deb
rm -rf rm -rf shadowsocks-qt5* v2.8.0.tar.gz

And if you are tired of compiling or building up the package, or you don’t want to “waste” your time, well, you can go to this post[5]. It provides the al-compiled package, you just need to download and sudo dpkg -i *.deb! Thanks again for my old friend’s contribution! Also, if you prefer, you can use my compiled debs. Use sudo dpkg -i *.deb to install these three files: libqtshadowsocks-dev libqtshadowsocks shadowsocks-libqtshadowsocks and finally install shadowsocks-qt5.

So, you can press Home/Windows and type shadowsocks-qt5 to open this software and add your own config(Do not forget to connect manually), also, you still have one more step to do:
Install FoxyProxy. There’s nothing different as make configurations on Windows/OS X(host->127.0.0.1, port->1080, etc.). But recently I have mistakenly deleted my repo and that means even for me, I CANNOT use PAC mode, unless I build the PAC file again, or choose to use others. Never mind, that’s not the point. At least we can pass through GFW, although a little troublesome.

Other Configurations

Since I newly installed an OS, that means I have to make a lot of changes on it(Language, Softwares, Themes and etc.) So, here are some extra(Post-Title-Free, namely, nonsense, just to avoid creating another post) steps I take.

Proxychains

We can bypass the firewall only if the software supports Proxy(Socks 5), and how about terminal(Command Line)? That’s why I have to installed this software(Under linux, nothing is more important than terminal).

1
2
sudo apt-get install proxychains
sudo vi /etc/proxychains.conf

If you want to set more detailed configurations, refer to this sample[6].

And add the following lines and save[7]:

1
2
3
4
5
6
7
8
9
10
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
quiet_mode
[ProxyList]
socks5 127.0.0.1 1080

Now, you can enter proxychains bash and use curl https://www.google.com to test if your terminal can get access to Google.

Change Source(Deprecated)

As the network environment on mainland China is really poor, there’s a great need for us to change our source to a mainland mirror server. Here, I still choose the USTC Mirror.

Use cp /etc/apt/source.list /etc/apt/source.list.bak to back up your original source file in case you break your file by accident so that you can recover it. The content looks like:

1
# # deb cdrom:[Debian GNU/Linux 8 _Jessie_ - Official Snapshot amd64 LIVE/INSTALL Binary 20170116-23:46]/ jessie main#deb cdrom:[Debian GNU/Linux 8 _Jessie_ - Official Snapshot amd64 LIVE/INSTALL Binary 20170116-23:46]/ jessie maindeb http://mirrors4.ustc.edu.cn/debian/ jessie maindeb-src http://ftp.us.debian.org/debian/ jessie maindeb http://security.debian.org/ jessie/updates maindeb-src http://security.debian.org/ jessie/updates main# jessie-updates, previously known as 'volatile'deb http://ftp.us.debian.org/debian/ jessie-updates maindeb-src http://ftp.us.debian.org/debian/ jessie-updates main

As you select the mirror when installing this system, the http://ftp.cn.debian.org may displays different(e.g. http://ftp.cn.debian.org/debian/). Considering that my ISP provides a poor IPv6 service and to avoid the domain name resolution going through IPv6 to USTC Mirror, we are going to use http://mirrors4.ustc.edu.cn to force the route to go through IPv4. We can easily use vi to open source.list and use :%s/ftp.us.debian.org/mirrors4.ustc.edu.cn/g [8]to replace the domain globally. Then save it and use sudo apt-get update to update the cache.

Install Codeblocks

As usual, I choose to install codeblocks(The best C/CPP dev tool for my daily use) from downloading the official installation file and install it. For example, from here[9] we can get the latest released binary file. And after that, you can extra the files by default GUI tool Archive Manager to the same directory and enter the directory jessie/amd64 in command line . Next thing you should do is use sudo dpkg -i *.deb to install the deb files. Unluckily, there are still some dependencies needed for this software to run normally, so you will see a lot of errors, e.g.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
dpkg: error processing package libcodeblocks0 (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libwxsmithlib0:
libwxsmithlib0 depends on libcodeblocks0 (= 16.01); however:
Package libcodeblocks0 is not configured yet.
libwxsmithlib0 depends on libwxbase3.0-0 (>= 3.0.2); however:
Package libwxbase3.0-0 is not installed.
libwxsmithlib0 depends on libwxgtk3.0-0 (>= 3.0.2); however:
Package libwxgtk3.0-0 is not installed.
dpkg: error processing package libwxsmithlib0 (--install):
dependency problems - leaving unconfigured
Processing triggers for menu (2.1.47) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
codeblocks
codeblocks-contrib
codeblocks-libwxcontrib0
libcodeblocks0
libwxsmithlib0

Thanks to Debian’s elegant design of package management, we can easily use sudo apt-get install -f to fix the dependencies automatically. At last, we just need to use sudo dpkg -i *.deb to install codeblocks again.

External Guides

Don’t know why, maybe it is because the new version of codeblocks adopted the new GTK(2.8->3.0), there are still a lot of bugs, for example, the most annoying one: Every time you create a new file and when saving it, the ERROR occurs. Just like following:

The cause of this error is Symbol Browser. I’ve tried to solve this problem but I failed. So, the only choice left for me is to disable symbol browser even if I have no idea of what it truly is. Go to Seetings->Editor->Code completion->Symbols browser and check Disable symbols browser and confirm and next time you create a new file and save, no more annoying alerts will jump off[10].


  1. USTC open source software mirror

  2. Installing Debian Linux on your Mac using Parallels Desktop

  3. shadowsocks-qt5/releases

  4. shadowsocks-qt5/wiki/Installation

  5. HOW TO INSTALL SHADOWSOCKS-QT5 FROM SOURCE CODE ON DEBIAN 8

  6. proxychains.conf

  7. Using Shadowsocks with Command Line Tools

  8. vim全局替换命令

  9. Download Codeblocks

  10. CB on Debian Jessie - Frequent shutdowns and error messages