首先搭建java环境:
apt-get install -y default-jre (或者安装openjdk-7-jre)
apt-get install -y default-jre (或者安装openjdk-7-jre)
这样java环境就搭建好了。
接着是搭建maven环境,参考http://briteming.blogspot.com/2013/10/linux-vpsjava-opoopress.html
接着是搭建maven环境,参考http://briteming.blogspot.com/2013/10/linux-vpsjava-opoopress.html
root@umh:~# mvn -version
Apache Maven 3.0.5
(0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
(0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-042stab103.6", arch: "amd64", family: "unix"
root@umh:~#
(运行
mvn -version
命令,检验是否正确地安装了 Maven。如上的显示则表明正确地安装了 Maven。)
然后,
git clone https://github.com/ksfzhaohui/shadowsocks-netty-server
cd shadowsocks-netty-server
root@umh:~/shadowsocks-netty-server# ls
README.md conf pom.xml shell src
root@umh:~/shadowsocks-netty-server# mvn package
(会在当前目录下,生成target目录)
root@umh:~/shadowsocks-netty-server# ls
README.md conf pom.xml shell src target
root@umh:~/shadowsocks-netty-server# cd target
root@umh:~/shadowsocks-netty-server/target# ls
archive-tmp classes shadowsocks-netty-server-0.0.1-bin.zip shadowsocks-netty-server-0.0.1.jar
root@umh:~/shadowsocks-netty-server/target# rm -rf shadowsocks-netty-server-0.0.1.jar
(当前目录下的这个shadowsocks-netty-server-0.0.1.jar有问题,故删除它)
(当前目录下的这个shadowsocks-netty-server-0.0.1.jar有问题,故删除它)
root@umh:~/shadowsocks-netty-server/target# unzip shadowsocks-netty-server-0.0.1-bin.zip
root@umh:~/shadowsocks-netty-server/target#
root@umh:~/shadowsocks-netty-server/target# ls
archive-tmp classes shadowsocks-netty-server-0.0.1 shadowsocks-netty-server-0.0.1-bin.zip
root@umh:~/shadowsocks-netty-server/target# cd shadowsocks-netty-server-0.0.1
root@umh:~/shadowsocks-netty-server/target/shadowsocks-netty-server-0.0.1# ls
conf lib logs shadowsocks-netty-server-0.0.1.jar shadowsocks-netty-server.bat shadowsocks-netty-server.sh
root@umh:~/shadowsocks-netty-server/target/shadowsocks-netty-server-0.0.1# nano conf/config.xml
root@umh:~/shadowsocks-netty-server/target/shadowsocks-netty-server-0.0.1# cat conf/config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<local_port>10820</local_port>
<method>aes-256-cfb</method>
<password>your-password</password>
</config>
root@umh:~/shadowsocks-netty-server/target/shadowsocks-netty-server-0.0.1# java -jar shadowsocks-netty-server-0.0.1.jar
不过命令:java -jar shadowsocks-netty-server-0.0.1.jar是运行在前台的,容易退出。我们可以利用systemd来把该命令运行为service:
nano /etc/systemd/system/shadowsocks-netty-server.service
内容为:
[Unit]
After=network.target
[Service]
WorkingDirectory=/root/shadowsocks-netty-server/target/shadowsocks-netty-server-0.0.1/
ExecStart=/usr/bin/java -jar /root/shadowsocks-netty-server/target/shadowsocks-netty-server-0.0.1/shadowsocks-netty-server-0.0.1.jar
Restart=always
[Install]
WantedBy=multi-user.target
然后运行:
systemctl start shadowsocks-netty-server
systemctl enable shadowsocks-netty-server
服务器端搭建完成。
至于客户端,通用通常的ss客户端程序。也可使用此文https://briteming.blogspot.com/2018/10/javassshadowsocks-netty.html里所说的客户端程序。
项目地址:https://github.com/ksfzhaohui/shadowsocks-netty-server
----------
----------
https://briteming.blogspot.com/2020/04/shadowsocks-java-by-tongxiji.html
https://briteming.blogspot.com/2020/04/shadowsocks-java-by-zhihengjiang.html
https://github.com/Bestoa/shadowsocks-vertx
https://briteming.blogspot.com/2020/04/shadowsocks-java-by-zhihengjiang.html
https://github.com/Bestoa/shadowsocks-vertx
https://github.com/dawei101/shadowsocks-android-java
https://github.com/shadowsocks/shadowsocks-android
No comments:
Post a Comment