Как установить shadowsocks на ubuntu

Обновлено: 07.07.2024

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

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.

Fedora/Centos

OpenSUSE

Archlinux

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

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.

Create a Configuration File

we will create a configuration file under /etc/

Put the following text in the file. Replace server-ip with your actual IP and set a password.

Save and close the file. Next start the client using command line

To run in the background

Auto Start the Client on System Boot

Edit /etc/rc.local file

Put the following line above the exit 0 line:

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:

If your sslocal command works then you will get this ouput:

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.

Если нужно заходить на сайты, которые у вас в стране заблокированы — эта инструкция для вас. В предыдущей записи я рассказал, как установить большой пакет Streisand. Но если нужен только шифрованный прокси, достаточно установить Shadowsocks.

Что понадобится

  1. Компьютер
    Буду показывать на примере Windows, для других систем процесс очень похож.
  2. 10-15 минут
    Для настройки всего софта
  3. VPS-сервер, или PayPal/Visa/Mastercard без денег
    Если своего сервера ещё нет, расскажу как бесплатно арендовать VPS на пару месяцев. Потребуется не более 0.1 доллара, и то вернут: нужно для активации бонусных $100 Digital Ocean (на два месяца).

Что будем делать

  1. Арендуем сервер на Digital Ocean
    Можно и любой другой хостинг, главное чтобы он находился в стране, где нет блокировок интернета. Выбрал именно DO потому, что они дают новичку $10 при регистрации по реферальной ссылке.
  2. Установим Shadowsocks
    Простой и достаточно надёжный прокси для доступа к заблокированным сайтам.
  3. Настроим свой ПК и смартфон
    Чтобы смотреть YouTube и пользоваться Google Play из-за Великого Китайского Фаервола, либо заходить на LinkedIn в обход Роскомнадзора.

Аренда сервера

Уже есть сервер на Ubuntu? Идите к следующему пункту.

Нет сервера? Сделайте всё по этой инструкции (выбирайте Ubuntu 17.04 x64) и возвращайтесь.

Устанавливаем Shadowsocks

Будем вводить команды в терминал Putty. После каждой команды нужно нажать Enter.

Настраиваем ПК и смартфон

Windows:

  1. Скачайте Shadowsocks for Windows
  2. Запустите Shadowsocks.
  3. Нажмите правой кнопкой на значок Shadowsocks в трее рядом с часами, перейдите в Servers > Edit server
  4. Введите параметры:
    IP-адрес вашего сервера
    Порт 8388
    Метод aes-256-cfb
    Ваш пароль
  5. Сохраните настройки.
  6. Снова нажмите на Shadowsocks правой кнопкой, выберите Enable.

Вот и всё. Попробуйте зайти на заблокированный сайт.

Android

Установите с Google Play или из APK, введите параметры (как в примере с Windows), подключайтесь.

Послесловие

Shadowsocks на своём сервере — не средство анонимности. Он не скроет вашу личность ни от сайта, ни от провайдера. Зато поможет зайти на сайт, который по какой-то глупости заблокирован. Другими словами, искать работу на LinkedIn из Москвы и смотреть котиков на YouTube из Китая — нормально (пока), а сидеть в Сургуте и призывать к федерализации Сибири на форуме — очень плохая затея.

Вам также может понравиться


Английский на Amazfit Smartwatch (Pace)


Католическая Церковь в Китае


Пишем резюме для китайской компании

44 комментария к « Shadowsocks: свой VPN за пять минут »

Возникла проблема на маке, Создаём конфигурационный файл

sudo nano /etc/shadowsocks-libev/config.json
после чего не удается его сохранить в nano
пишет error no such file or directory
делаю через терминал все (не пути)

кстати вот что было до

как создать нужную папку?

блин вот это пришлось покопаться, и то не уверен все ли ок, через github
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:max-c-lv/shadowsocks-libev
sudo apt-get update
sudo apt install shadowsocks-libev

Ну и приключения у вас. 🙂
Я тоже не большой специалист, все ответы хожу искать в гугол. Отпишитесь, как получилось!

с небольшой оговоркой*

далее устанавливаем на свой сервер shadowsocks (команды последовательно):
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:max-c-lv/shadowsocks-libev
sudo apt-get update
sudo apt install shadowsocks-libev

затем согласно инструкции выше создаем и правим конфигурационный файл и далее по инструкции (активация, добавление в автозапуск)

после этого работает

* не уверен, что это работает, но порт по которому происходит подключение лучше изменить на какой нибудь другой, нужно погуглить, я много где встречал, что порт по умолчанию лучше сменить (провайдер может заблокировать его и все, как впрочем и другой, поэтому как я понял нужно ставить какой-то часто встречаемый, а какой не пишут)
сделать это можно так:
в Step Five — Configure SSH Daemon из инструкции по первичной настроке, при октрытии файла из этого пунката одной из первых строк будет строка Port 22 это и есть порт по умолчанию, нужно изменить его на другой, затем подключение к серверу нужно будет делать с припиской:
ssh root@server -p 1234(заменить цифры на свой порт)

Все получилось, работает, только бонус не упал, буду долбить поддержку! Спасибо Вам!

Круто. Ну с бонусом они конечно засранцы, сорян.
Я причём специально зарегал себе отдельный аккаунт для написания статьи, чтобы убедиться, что правила не поменялись за два года. А у них, видимо, для каждой страны правила немного отличаются.

Поддержка ответила, что по их данным я не регистрировался по реф ссылке, хотя я открывал ссылку отсюда, и даже перед регистрацией убедился, что в адресной строке есть слово refferal, но не могу сказать точно не обновил ли я страницу по каким-либо причинам, вобщем бонус они мне дадут, но к сожалению к вашей ссылке его не привяжут 🙁 Извините, и еще раз спасибо!

Ну главное что вам дали, а не зажали себе 🙂

Я вообще приятно удивлён стабильностью shadow socks на своём сервере. Пинг отвратный, но подключается стабильно всегда. Надеюсь, так и дальше будет 🙂

Привет всем!
Столкнулся с такой же проблемой как у Антона. Вроде его действия помогли, спасибо большое за это. но дальше возник тупняк. Дошел до

Создаём конфигурационный файл
sudo nano /etc/shadowsocks-libev/config.json

Вставить то вставил. А что дальше то? Подмогните плиз

^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos ^Y Prev Page M-\ First Line M-W WhereIs Next^^ Mark Text
^X Exit ^R Read File ^\ Replace ^U Uncut Text ^T To Spell ^_ Go To Line ^V Next Page M-/ Last Line M-] To Bracket M-^ Copy Text
внизу тут еще такие страшные штуки высветились. Так как я в этом деле полный ноль делал все по инструкции. Если есть варианты решения подскажите.

Чтобы сохранить текст, надо нажать ctrl+o

[ Error writing /etc/shadowsocks-libev/config.json: No such file or directory ]
это как?

может кому поможет. проделал все пункты снова. глянул список обновлений. помогло

А в чём разница?

Ребят, кто сталкивался с данной проблемой. Почти опустел баланс на DIGITAL OCEAN (упал до $3). Скорость сразу заметно упала, пополнил баланс, VPN вообще не тянет (до этого стабильно работал пару месяцев после последнего моего обращения на сайте) . Сейчас не 4G сеть не WIFI не тянут, практически не работает. Есть какие-то решения данной проблемы? Заранее всем спасибо!

Сомневаюсь, что баланс связан со скоростью. Скорее китайский фаервол шалит. Попробуйте подключиться с другого провайдера или хотя бы с другой сим-карты, сравните скорость.

пытался, и с 4G и с других точек все равно та же самая беда.

Видимо, IP попал в чёрный список. Китайский фаервол звереет.

я развернул сервер и комментарий Антона пригодился, а можно ли как то создавать на один и тот же сервер разные QR коды? и какой лимит по умолчанию?

Купить чужой прокси/впн всегда быстрее, но статья не о том.

Добрый день. Установил через сервер в Сингапуре из Китая, хоть Вы и не рекомендовали, но скорость в 3 раза выше, чем без Shadowsocks. Ставил, правда, Гугл аутлайн, ибо пока разбираюсь в деталях, а инет нужен уже сейчас. Тем не менее, мой ip как бы в Штатах, Калифорния. Так и должно быть? Почему не Сингапур? Спасибо

Не могу понять как настроить что бы сервер работал одновременно и на внешний и на внутренний IP, что бы находясь в локальной сети использовать shadowsocks

что бы пользователи локальной сети могли пользоваться SS.
к примеру когда я вне локальной сети, я подключаюсь к белому внешнему IP
когда я в локальной сети, я пытаюсь настроить клиент SS на внутренний адрес сервера, но ничего не работает.

Вы хотите поставить сервер Shadowsocks в своей локальной сети? Как он тогда будет блокировки обходить?:)

а мне не нужно что бы он обходил блокировки.
мне нужно что бы я цеплялся к нему из вне. тем самым экономя трафик, до него у меня траф бесплатен (интернет не безлимитен). и что бы мог им пользоваться из внутренней сети так же.

Т.е. упрощённо говоря, у вас на обычном компьютере лимитированный тариф на всё, кроме вашего сервера, который в свою очередь подключён к безлимитному интернету, и вы хотите использовать сервер как шлюз?

Давайте лучше в TG @golosoff если не сложно.

Такой конфиг что то не работает

Мы можем предложить качественные услуги прокси-серверов пакетами. Вам лично нужен стабильный частный прокси для работы в Instagram, Вконтакте,Однокласниках или Авито? Вы увлекаетесь букмекерскими ставками или покером? SEO,SMM, по настоящему безопасный серфинг либо остальные задачи? В таком случае вы по адресу.

Shadowsocks R сейчас используют
Так же стоит в crontab ucaresystem core и другие штучки дрючки
Один и тот же IP китайцы год не могут найти

А для iOS клиент есть?

4. Запускаем сервер и ставим его на автозапуск как в изначальной инструкции
sudo systemctl restart shadowsocks-libev
sudo systemctl enable shadowsocks-libev

Если будут вопросы, то не стесняйтесь обращаться в поддержку Яндекса- они реально помогают )

Яндекс.облако всем хорошо, кроме нахождения в России 🙂 Линкедин и телеграм уже заблокированы, дальше будет хуже, к сожалению.

Pjalusta kto nibut zdelayte wideo urok shadowsocks kak sdelat konfigurasiya

Mne dal znakomi drug config file wot eto
ssr://NDYuOC4yMjAuMTMwOjgwNjM6b3JpZ2luOmNoYWNoYTIwOmh0dHBfc2ltcGxlOlpHa3liR0V5YmpZei8_b2Jmc3BhcmFtPSZwcm90b3BhcmFtPSZyZW1hcmtzPU9EQTJNdyZncm91cD1RMnhwWlc1MGN3
Oak eto delay video urok snimite ssylka dayte please kak eto delat

Прямо в тексте этой статьи написано, что сервер можно арендовать на DigitalOcean или любом подобном виртуальном хостинге.

This tutorial is going to show you how to set up Shadowsocks proxy server on Ubuntu. Shadowsocks is a lightweight, fast, and secure Socks5 proxy to bypass Internet censorship. We will learn how to set up the server-side and how to configure the desktop client on Ubuntu. There are many implementations of Shadowsocks, this tutorial shows you how to use Shadowsocks-libev, because

Prerequisites

To complete this tutorial, you will need:

  • A VPS (Virtual Private Server). I recommend Vultr. They offer 512M memory high performance VPS for just $2.5 per month, which is perfect for your private proxy server.
  • Then install Ubuntu on your VPS.

Step 1: Install Shadowsocks-libev Server on Ubuntu

SSH into your remote Ubuntu server. Shadowsocks-libev is included in Ubuntu repository since 17.04, so you can install it with:

Ubuntu 16.04 users can install it from PPA by running the following commands. software-properties-common is needed if you want to install software from PPA. It may be missing on your Ubuntu server.

The default contents of the file are as follows.

We need to change 127.0.0.1 to 0.0.0.0 , so Shadowsocks-libev server will listen on the public IP address. Then change server_port to other port numbers like 8888. The password was randomly generated, so you can leave it as it is.

Save and close the file. Then restart shadowsocks-libev service for the changes to take effect.

Enable auto-start at boot time.

If you see the following error.

You can fix this error by installing rng-tools .

Now you can start Shadowsocks-libev service.

Step 2: Configure Firewall

If you are using iptables firewall on your server, then you need to allow traffic to the TCP and UDP port Shadowsocks is listening on. For example, if port 8888 is being used by Shadowsocks, then run the following command:

If you are using UFW firewall, then run the following commands:

If you are using AWS or Google Cloud, then you need to configure firewall at the web-based control panel.

Step 3: Install and Configure Shadowsocks-libev Client

Ubuntu Desktop

The shadowsocks-libev package contains both the server software and client software. On Ubuntu 20.04, 18.04 desktop, run the following commands to install Shadowsocks-libev.

On Ubuntu 16.04 desktop, run the following commands to install Shadowsocks-libev.

Shadowsocks-libev (the server) will automatically start after being installed. You need to stop Shadowsocks server on Ubuntu desktop.

Also, disable auto-start at boot time.

You can replace location-of-your-server with something like SFO, LAX. Then edit the client config file.

Change the server address to the public IP address of your server, and add the following line to tell the client to listen on 127.0.0.1.

So the client config file will look like this:

Save and close the file. Then we can start the client with:

And enable auto-start at boot time.

Windows Desktop

shadowsocks windows client

If you have several proxy servers, you can click the Add button to add more proxy servers. Note that you use only one proxy server at a time.

Step 4: Configure Web Browser to Use the Socks Proxy

To make your program use a socks proxy, the program must support socks proxy. Programs like Firefox, Google Chrome and Dropbox allows users to use proxy. I will show you how to configure Firefox and Google Chrome.

Firefox

In Firefox, go to Edit > Preferences > General (or Tools -> Options -> General). Then scroll down to the bottom and click Settings in Network Proxy. In the Connection Settings window, select manual proxy configuration. Then select SOCKS v5 because Shadowsocks is a Socks5 proxy. Enter 127.0.0.1 in the SOCKS Host field and 1080 in the port field. Make sure Proxy DNS when using SOCKS v5 is enabled. Click OK to apply these modifications.

shadowsocks-libev ubuntu 16.04

Google Chrome

google chrome Proxy SwitchyOmega

Once the extension is installed in Google Chrome, configure a proxy server as follows:

  • Choose the SOCKS5 protocol.
  • Set 127.0.0.1 as the server address.
  • Set 1080 as the port number.

google chrome proxy command line

Apply the changes. Then click the extensions icon on the upper-right corner and click Proxy SwithyOmega .

proxy swithy omega shadowsocks-libev

switchyomega default proxy

Now your proxy should be working.

Step 5: DNS Leak Test

shadowsocks-libev ubuntu install

shadowsocks-libev ubuntu 17.10

Proxy in Command Line

To let your command line programs use the proxy, you can install tsocks .

Then edit the configuration file.

Find the following line:

Save and close the file. Now you can allow you command-line program to use Shadowsocks proxy like this:

Enable TCP Fast Open

You can speed up Shadowsocks by enabling TCP fast open. TCP is a connection-oriented protocol, which means data can only be exchanged after a connection is established, which is done via the three-way handshake. In other words, traditionally, data can only be exchanged after the three-way handshake is complete. TCP fast open (TFO) is a mechanism that allows data to be exchanged before three-way handshake is complete, saving up to 1 round-trip time (RTT).

TCP fast open support is merged to Linux kernel since version 3.7 and enabled by default since version 3.13. You can check your kernel version by running:

To check TCP fast open configuration on your Ubuntu server, run

It can return 4 values.

All my Ubuntu VPS (Virtual Private Server) returned 1 after running the above command. We want tcp_fastopen set to 3 on our server. To achieve that, we can edit the sysctl configuration file.

Then paste the following line at the end of the file.

Reload sysctl settings for the change to take effect.

Then you will also need to enable TCP fast open in Shadowsocks configuration file.

Add the following line.

So your Shadowsocks server configuration file will look like this:

Note that the last config line has no comma. Save and close the file. Then restart Shadowsocks server.

You also need to edit the Shadowsocks client configuration file and restart it to enable TCP fast open on Ubuntu desktop.

Enable TCP BBR

TCP BBR is a TCP congestion control algorithm that can drastically improve connection speed. Check out the following tutorial.

For more usage on Shadowsocks, check the manual.

Troubleshooting

Every now and then, my Shadowsocks-libev proxy stops working and the following error is displayed on the server side when I check the status with systemctl .

On the client-side, the error returned by systemctl is:

Put the following line at the end of the file.

This will restart the service every 3 hours. That is to say, restart happens at 12am, 3am, 6am, 9am and so forth. Note that the time is determined by cron. It is not determined by calculating how long the service has been running.

If you see the following error in Shadowsocks-libev log.

If you have your own DNS resolver running on the Shadowsocks server, you can specify 127.0.0.1 as the name server.

[Total: 20 Average: 4.5 ]

Thank you for such good tutorial!

You are welcome, subscribe for more good stuff.

Thank you for such good tutorial!! XD

You have a network problem, which is not controlled by your operating system.

Thanks, you are right, that occurs when I visit websites in LAN network.

Shadowsocks is working for me in China. Never used ShadowsocksR before. Maybe you can use OpenConnect VPN, which is also working in China.

hello and thank you for great tut 🙂

can i install Shadowsocks on ubuntu Desktop without the Shadowsocks-server ?

and thnk you again

This is an awesome tutorial. Thanks.

Hey, I used to live in China and used shadowsocks and I set it up and it worked. It kinda stopped working recently so I decided to migrate my virtual server to another location and set it up again but now I am getting this error message when I check if it is running:

Any idea how to fix this?
Thanks in advance.

Thank you so much, with these libs I was able to use shadownsocks is is the only tutorial that works with Ec2 + Ubuntu 18.04 LTS

after setting shadownsocks server on my laptop PC (with ubuntu 16.04) can I use the shadownsocks client android app to connect to with by setting a profile in the app with the details written in the Shadowsocks configuration file?

Shadowsocks is an open source socks5 proxy that can be used to bypass firewall and unblock websites. Originally developed by a Chinese called clowwindy on Github, now the application has been implemented in all kinds of programming languages such as C, C++, Go, Python and the like. This Tutorial will guide you through setting up your own Shadowsocks server and how to use it on your desktop computer, android and iOS. I assume you already have access to a VPS or dedicated server.

Shadowsocks VS VPN

As you may already know, you can use VPN (Virtual Private Network) to bypass firewall and protect your anonymity on the web. Do you need another software like shadowsocks to do the same? One thing you can find is that When you are using VPN, all your Internet traffic is routed through VPN. Because VPN servers are usually located outside your country, this can slow down your Internet speed especially when you are visiting websites inside your country.

Setting Up Shadowsocks on Your Server

There are many ways to install shadowsocks on Linux server, but I will show you the easiest way. First, install python pip and then use pip to install shadowsocks. m2crypto will make encryption a little faster.

Create a configuration file with a command line text editor like nano .

Put the following text into the file.

Explanation of each field:

Replace the green text with your info. Save and close the file, then start shadowsocks server.

To stop shadowsocks server:

Restart Shadowsocks server:

Check Shadowsocks log

You may need to allow traffic through your Shadowsocks server port in iptables firewall by running command: sudo iptables -I INPUT -p tcp --dport 8000 -j ACCEPT

Auto Start on System Boot

If you want shadowsocks server to automatically start on system boot, then edit /etc/rc.local file

Add the following line to the file above exit 0 line

Install and Configure Shadowsocks Client on Desktop Linux

Ubuntu users install it from PPA

Fedora/RHEL users can install it from Copr Repository

Mac and Windows users refer to this page for downloading shadowsocks client.

Configure Shadowsocks Client

Once downloaded and installed on your computer, open it. And right click on the blank background, choose add and then manually to manually add a profile.

ss-client

ss2

Back in the connection manager window, choose you newly added profile and click connect on the upper-left corner.

ss3

Now your shadowsocks client is connected to your server. Next we will tell Firefox and chrome to use your shadowsocks client.

Configure Firefox And Google Chrome to Use Shadowsocks

Open up Firefox, and in the menu bar, choose Edit and then Preferences. And then click the Advanced tab. choose network and then settings.

firefox-proxy

In the connection settings window, choose manual proxy configuration and then on the socks host field enter 127.0.0.1, enter 1080 in the port field. Be sure to choose socks v5 as the socks type. And finally click the OK button.

firefox-proxy2

Now your firefox can visit google, youtube and other blocked sites!

Читайте также: