▒配置系统
/etc/yum.repos.d/
yum clean all yum makecache #更新软件 yum update▒ 配置Nginx
touch /etc/yum.repos.d/nginx.repo vim /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo #baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1
yum clean all yum makecache yum install nginx #启动 nginx #停止|重启 nginx -s (stop|quit|reload)
▒配置JDK
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
tar -zxvf jdk-8u111-linux-x64.tar.gz
vim /etc/profile
export JAVA_HOME="/home/jdk1.8.0_111" export PATH="$JAVA_HOME/bin:$PATH" export JAVA_OPTS="-server -Xss100m -Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=256m -Dspring.profiles.active=test"
source /etc/profile
[root@conan home]# java -version java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
▒设置TOMCAT
wget http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M15/bin/apache-tomcat-9.0.0.M15.tar.gz
tar -zxvf ./apache-tomcat-9.0.0.M15.tar.gz
vim ./apache-tomcat-9.0.0.M15/conf/server.xml
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
▒设置maven
wget http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar -zxvf ./apache-maven-3.3.9-bin.tar.gz
export JAVA_HOME="/home/jdk1.8.0_111" export MAVEN_HOME="/home/apache-maven-3.3.9" export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH"
source /etc/profile
[root@conan home]# mvn -version Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00) Maven home: /home/apache-maven-3.3.9 Java version: 1.8.0_111, vendor: Oracle Corporation Java home: /home/jdk1.8.0_111/jre Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux", version: "2.6.32-042stab120.3", arch: "amd64", family: "unix"
<servers> <server> <id>xyz-release</id> <username>admin</username> <password>admin123</password> </server> <server> <id>xyz-snapshot</id> <username>admin</username> <password>admin123</password> </server> </servers> <mirrors> <mirror> <id>xyz-group</id> <mirrorOf>*</mirrorOf> <name>unknown</name> <url>http://172.16.81.52:8081/repository/xyz-group/</url> </mirror> </mirrors>设置JDK版本,方法一。 打开 %maven%/conf/settings.xml 文件并编辑它:
<profiles> <profile> <id>development</id> <activation> <jdk>1.7</jdk> <activeByDefault>true</activeByDefault> </activation> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion> </properties> </profile> </profiles>方法二, 在 <build> 节点添加如下配置:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build>
▒配置GIT
wget https://github.com/git/git/archive/v2.11.0.tar.gz
yum install lrzsz
tar -zxvf v2.11.0.tar.gz
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc yum install gcc perl-ExtUtils-MakeMaker wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxvf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make && make install
wget https://fedorahosted.org/releases/x/m/xmlto/xmlto-0.0.28.tar.gz ./configure --prefix=/usr/local/xmlto make && make install
wget https://github.com/git/git/archive/v2.11.0.tar.gz
yum remove git make configure ./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv make all doc make install install-doc install-html echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc source /etc/bashrc
[root@conan git-2.11.0]# git --version git version 2.11.0
git config --global user.name "jlcon"
git config --global user.email "jlcon@qq.com"
git config --global credential.helper store
[root@conan home]# ssh-keygen -t rsa -C "jlcon@qq.com" Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 0f:f0:c3:d1:6c:1d:9c:fb:67:ac:9f:4f:13:95:46:a2 jlcon@qq.com The key's randomart image is: +--[ RSA 2048]----+ | ..o . | | o .+.o .| | . . +E.. o.| | + o . . .| | S . o | | + . =| | . =.| | ..o| | o+| +-----------------+
证书添加到 git.oschina.net
[root@conan home]# cat /root/.ssh/id_rsa.pub
[root@conan home]# ssh -T git@git.oschina.net The authenticity of host 'git.oschina.net (120.55.226.24)' can't be established. RSA key fingerprint is e3:ee:82:78:fb:c0:ca:24:65:69:ba:bc:47:24:6f:d4. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'git.oschina.net,120.55.226.24' (RSA) to the list of known hosts. Enter passphrase for key '/root/.ssh/id_rsa': Welcome to Git@OSC, jlcon!如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下
git stash git pull git stash pop git diff -w +文件名如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下
git reset --hard git pull
▒配置防火墙
iptables -nvL --line-number
iptables -I INPUT <规则行号> -p tcp --dport <端口号> -m state --state NEW,ESTABLISHED,RELATED,INVALID -j ACCEPT
/etc/init.d/iptables save
service iptables start
#增加端口到指定行 iptables -I INPUT <规则行号> -p tcp --dport <端口号> -m state --state NEW,ESTABLISHED,RELATED,INVALID -j ACCEPT #增加端口到末尾 iptables -A INPUT -p tcp --dport <端口号> -m state --state NEW,ESTABLISHED,RELATED,INVALID -j ACCEPT #按规则行号修改 iptables -R INPUT <规则行号> -p tcp --dport <修改端口号> -m state --state NEW,ESTABLISHED,RELATED,INVALID -j <DROP/ACCEPT> #删除防火墙规则 iptables -D INPUT <规则行号> #开启/停止/重启防火墙 service iptables <start/stop/restart>
▒配置mysql
yum -y install mysql-server
chkconfig mysqld on
service mysqld start
mysql -u root select user,host,password from mysql.user; set password for root@localhost=password('root'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; FLUSH PRIVILEGES;
▒配置Shadowsocks Server
yum install python-setuptools && easy_install pippip install shadowsocks
或者:
# yum install python-setuptools && easy_install pip # pip install shadowsocks
touch /etc/shadowsocks.json { "server":"0.0.0.0", "local_address":"127.0.0.1", "local_port":8090, "port_password":{ "<客户端口1>":"<客户密码1>", "<客户端口2>":"<客户密码2>" }, "timeout":300, "method":"aes-256-cfb", "fast_open": false }
ssserver -c /etc/shadowsocks.json -d <start|stop|restart>
https://github.com/shadowsocks/shadowsocks-windows/releases
https://github.com/shadowsocks/shadowsocks-android/releases