设为首页收藏本站language 语言切换
查看: 4004|回复: 0
收起左侧

Install And Use Shadowsocks Command Line Client on Linux

[复制链接]
发表于 2018-2-23 10:13:48 | 显示全部楼层 |阅读模式
In a previous post, I showed you how to build a shadowsocks server on your own server and install the client software on your Linux, Windows, and Mac Desktop. And also on your Android and iOS devices. This article will show you how to install and use the command line client on Linux including Debian, Ubuntu, Fedora, CentOS, OpenSUSE and Archlinux.
Install the Command Line Client
If you prefer command line client, then you can install it on your Linux with the following command.
Debian
sudo apt-get install python-pip
sudo pip install shadowsocks
Ubuntu
Yes, you can use the above commands to install shadowsocks client on ubuntu. But it will install it under
~/.local/bin/ directory and it causes loads of trouble. So I suggest using su to become root first and then issue the following two commands.

apt-get install python-pip
pip install shadowsocks
Fedora/Centos
sudo yum install python-setuptools   or   sudo dnf install python-setuptools
sudo easy_install pip
sudo pip install shadowsocks
OpenSUSE
sudo zypper install python-pip
sudo pip install shadowsocks
Archlinux
sudo pacman -S python-pip
sudo pip install shadowsocks
As you can see the command of installing shadowsocks client is the same to the command of installing shadowsocks server, because the above command will install both the client and the server. You can verify this by looking at the installation script output
Downloading/unpacking shadowsocks
Downloading shadowsocks-2.8.2.tar.gz
Running setup.py (path:/tmp/pip-build-PQIgUg/shadowsocks/setup.py) egg_info for package shadowsocks

Installing collected packages: shadowsocks
Running setup.py install for shadowsocksInstalling sslocal script to /usr/local/binInstalling ssserver script to /usr/local/binSuccessfully installed shadowsocks
Cleaning up...
sslocal is the client software and ssserver is the server software. On some Linux distros such as ubuntu, the shadowsocks client sslocal is installed under /usr/local/bin. On Others such as Arch sslocal is installed under /usr/bin/. Your can use whereis command to find the exact location.
user@debian:~$ whereis sslocal
sslocal: /usr/local/bin/sslocal

Create a Configuration File
we will create a configuration file under /etc/
sudo vi /etc/shadowsocks.json
Put the following text in the file. Replace server-ip with your actual IP and set a password.
{
"server":"server-ip",
"server_port":8000,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"your-password",
"timeout":600,
"method":"aes-256-cfb"
}
Save and close the file. Next start the client using command line
sslocal -c /etc/shadowsocks.json
To run in the background
sudo sslocal -c /etc/shadowsocks.json -d start
Auto Start the Client on System Boot
Edit /etc/rc.local file
sudo vi /etc/rc.local
Put the following line above the exit 0 line:
sudo sslocal -c /etc/shadowsocks.json -d start
Save and close the file. Next time you start your computer, shadowsocks client will automatically start and connect to your shadowsocks server.
Check if It Works
After you rebooted your computer, enter the following command in terminal:
sudo systemctl status rc-local.service
If your sslocal command works then you will get this ouput:
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2015-11-27 03:19:25 CST; 2min 39s ago
Process: 881 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/rc-local.service
├─ 887 watch -n 60 su matrix -c ibam
└─1112 /usr/bin/python /usr/local/bin/sslocal -c /etc/shadowsocks....
As you can see from the last line, the sslocal command created a process whose pid is 1112 on my machine. It means shadowsocks client is running smoothly. And of course you can tell your browser to connect through your shadowsocks client to see if everything goes well.
If for some reason your /etc/rc.local script won’t run, then check the following post to find the solution.
How to enable /etc/rc.local with Systemd
Rate this tutorial
明骏.png
您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-4-27 17:19 , Processed in 0.093927 second(s), 23 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表