在linux vps上。
运行apt-get install -y maven*
(yum install -y maven*),会把java,openjdk和maven一起装好。
git clone https://github.com/abc123lzf/flyingsocks
cd flyingsocks
cd common
mvn package
cd ..
mvn package
(此命令会分别在子目录server目录和client目录下,生成target目录。)
cd server/target
[root@racknerd-7b97d8 target]# ls
archive-tmp flyingsocks-server-bin.zip maven-status
classes generated-sources
flyingsocks-server-3.0-SNAPSHOT.jar maven-archiver
[root@racknerd-7b97d8 target]# unzip flyingsocks-server-bin.zip -d /opt
[root@racknerd-7b97d8 target]# cd /opt/flyingsocks-server
[root@racknerd-7b97d8 flyingsocks-server]# ls
bin config lib README.md
[root@racknerd-7b97d8 flyingsocks-server]# cd config
[root@racknerd-7b97d8 config]# ls
banner encrypt META-INF server.json
config.properties log4j.properties mybatis-config.xml user-example.json
[root@racknerd-7b97d8 config]# nano server.json
[root@racknerd-7b97d8 config]# cat server.json
[
{
"name": "default",
"port": 2020,
"cert-port": 7060,
"max-client": 10,
"encrypt": "OpenSSL",
"auth-type": "simple",
"password": "123456"
}
]
(您可以修改
port的值和password的值。)
[root@racknerd-7b97d8 config]# cd encrypt
[root@racknerd-7b97d8 encrypt]# ls
default
[root@racknerd-7b97d8 encrypt]# cd default
[root@racknerd-7b97d8 default]# ls
[root@racknerd-7b97d8 default]#
[root@racknerd-7b97d8 default]# openssl req -new -nodes -x509 -keyout private.key -out ca.crt
[root@racknerd-7b97d8 default]# ls
ca.crt private.key
[root@racknerd-7b97d8 default]# cd /opt/flyingsocks-server/bin
[root@racknerd-7b97d8 bin]# ls
log startup.bat startup.sh stop.sh
[root@racknerd-7b97d8 bin]# ./startup.sh
[root@racknerd-7b97d8 bin]# lsof -i:2020
(查看java是否监听了2020端口。如果监听了2020端口,则表明服务器端启动成功)
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 16550 root 48u IPv6 243724 0t0 TCP *:dpserve (LISTEN)
[root@racknerd-7b97d8 bin]#
在客户机器mac上。安装JDK 1.8环境。安装maven:
wget http://apache.mirror.anlx.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
tar xvf apache-maven-3.1.1-bin.tar.gz
cd apache-maven-3.1.1/bin
yudeMacBook-Air:bin brite$ ls
m2.conf mvn.bat mvnDebug.bat
mvn mvnDebug mvnyjp
yudeMacBook-Air:bin brite$ ./mvn -h
yudeMacBook-Air:bin brite$ ./mvn --version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800)
Maven home: /Users/brite/apache-maven-3.1.1
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
yudeMacBook-Air:bin brite$ echo 'export M2_HOME=/Users/brite/apache-maven-3.1.1' >> ~/.profile
yudeMacBook-Air:bin brite$ echo 'export PATH=$PATH:$M2_HOME/bin' >> ~/.profile
yudeMacBook-Air:bin brite$ . ~/.profile
yudeMacBook-Air:bin brite$ which mvn
/Users/brite/apache-maven-3.1.1/bin//mvn
yudeMacBook-Air:bin brite$ cd ~
yudeMacBook-Air:~ brite$ git clone https://github.com/abc123lzf/flyingsocks
cd flyingsocks
cd common
mvn package
cd ..
mvn package
(不过这里,遇错了。暂时未能搞定。服务器上的这一步是成功的。)
No comments:
Post a Comment