酸っぱいSS Centos7を構築する方法

酸っぱいcentos7を構築する方法

説明

言葉の個人利用、SS(酸味)がSSR(サワーミルク)のポイントよりも便利で、主に個々に依存しています。
この記事では唯一のCentOSシステムのため、この記事のコードの他のシステム部分は、他のシステムに共通の、わずかに異なるではありません。

1.システム構成

CentOSの7のx64

2.インストールに応じて、

次のコードの実行

yum update -y
yum install -y pcre pcre-devel git gettext gcc autoconf libtool automake make asciidoc xmlto c-ares-devel libev-devel


wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz && tar xf libsodium-1.0.18.tar.gz && cd libsodium-1.0.18 && ./configure && make -j2 && make install && cd /
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

export MBEDTLS_VER=2.6.0
wget https://tls.mbed.org/download/mbedtls-$MBEDTLS_VER-gpl.tgz
tar xvf mbedtls-$MBEDTLS_VER-gpl.tgz
pushd mbedtls-$MBEDTLS_VER
make SHARED=1 CFLAGS=-fPIC
make DESTDIR=/usr install
popd
ldconfig

# clean directory
rm -rf /tmp/shadowsocks-libev

# compile and install
cd /tmp
git clone https://github.com/shadowsocks/shadowsocks-libev.git
cd shadowsocks-libev
git submodule update --init --recursive
./autogen.sh
./configure
make
make install
cd ..
rm -rf /tmp/shadowsocks-libev

mkdir /etc/shadowsocks-libev
touch /etc/shadowsocks-libev/config.json

3.プロファイル

/Etc/shadowsocks-libev/config.jsonプロファイルは、
次のコードファイルを追加します

{
    "server_host": "你的服务器ip或域名",
    "server_port": 8111,
    "password":"密码",
    "timeout":300,
    "method":"rc4-md5",
    "fast_open": false
}

4.背景を設定します。

新しいファイルは、/ etc / default / shadowsocks-libevは
、次のコードファイルを追加します

# Defaults for shadowsocks initscript
# sourced by /etc/init.d/shadowsocks-libev
# installed at /etc/default/shadowsocks-libev by the maintainer scripts

#
# This is a POSIX shell fragment
#
# Note: `START', `GROUP' and `MAXFD' options are not recognized by systemd.
# Please change those settings in the corresponding systemd unit file.

# Enable during startup?
START=yes

# Configuration file
CONFFILE="/etc/shadowsocks-libev/config.json"

# Extra command line arguments
DAEMON_ARGS="-u"

# User and group to run the server as
USER=nobody
GROUP=nobody

# Number of maximum file descriptors
MAXFD=32768

5.サービスのスクリプトを追加します。

新しいファイルが/lib/systemd/system/shadowsocks-libev.service
ファイルに次のコードを追加します。

#  This file is part of shadowsocks-libev.
#
#  Shadowsocks-libev is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  This file is default for Debian packaging. See also
#  /etc/default/shadowsocks-libev for environment variables.

[Unit]
Description=Shadowsocks-libev Default Server Service
Documentation=man:shadowsocks-libev(8)
After=network.target

[Service]
Type=simple
EnvironmentFile=/etc/default/shadowsocks-libev
User=nobody
Group=nobody
LimitNOFILE=32768
ExecStart=/usr/local/bin/ss-server -c $CONFFILE $DAEMON_ARGS

[Install]
WantedBy=multi-user.target

6.コマンド

:スタートsystemctl start shadowsocks-libev
:ストップsystemctl stop shadowsocks-libev
再起動:systemctl restart shadowsocks-libev
ビューステータス:systemctl status shadowsocks-libev -f
ブート:systemctl enable shadowsocks-libev
キャンセルブーツ:systemctl disable shadowsocks-libev

おすすめ

転載: www.cnblogs.com/kujisa/p/11529593.html