安装jdk8
1、下载JDK
从官网下载jdk8
jdk-8u5-linux-x64.tar.gz
2、解压
$ tar -zxvf jdk-8u5-linux-x64.tar.gz
解压出来是一个jdk1.8.0_05文件夹
3、将文件夹移动到安装目录
$ sudo mv jdk1.8.0_05 /usr/local/
4、配置环境变量 ,更改/etc/profile文件
sudo gedit /etc/profile
在文件最后加上如下几行:
export JAVA_HOME=/usr/local/jdk1.8.0_05
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
5、更改默认配置选项 ,依次执行如下命令
sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_05/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_05/bin/javac 300
i add next:
sudo update-alternatives --install /usr/bin/jar jar /usr/local/jdk1.8.0_05/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/local/jdk1.8.0_05/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/local/jdk1.8.0_05/bin/javap 300
安装LNMP
安装ftp
apt-get install vsftpd -y
添加ftp帐号和目录
useradd -g ftp -d /home/wwwroot/myftp -M myftp
修改该账户密码:
passwd myftp
修改指定目录的权限
chown -R 777 /home/wwwroot/myftp
配置vsftp
vi /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
保存退出
编辑/etc/vsftpd.chroot_list文件,将ftp的账户名添加进去,保存退出
重启vsftp服务并测试登录
service vsftpd restart
mysql配置
添加root远程访问权限
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
查询结果
use mysql;
select host, user from user;
防火墙
iptables -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
iptables-save
删除第五条规则
iptables -D INPUT 5
查看
cat /etc/iptables.rules
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
resin配置
下载好后解压 查看 cat RENAME 安装
安装好后 查看 log 运行端口
nginx配置
vim /usr/local/nginx/conf/nginx.conf
server
{
listen 8888 default_server;
#listen [::]:80 default_server ipv6only=on;
server_name dht.jiaotuhao.com;
location / {
proxy_pass "http://localhost:8080/";
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 60;
proxy_read_timeout 600;
proxy_send_timeout 600;
}
#error_page 404 /404.html;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
location ~ /.
{
deny all;
}
access_log /home/wwwlogs/resin.log access;
}
nginx -s reload
dht.jiaotuhao.com:8888 就能正常访问了
执行jar
CURR_DIR=/home/jar
RUN_PATH=$CURR_DIR/dist/dht-0.0.1-SNAPSHOT.jar
RUN_MAIN=org.solq.dht.Main
JAVA_HOME=/down/jdk1.8.0_51
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$CURR_DIR/lib:$CURR_DIR:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
java -version
for jarfile in `ls $CURR_DIR/lib/*.jar`
do
CLASSPATH=$CLASSPATH:$jarfile
done
JVM_ARGS="-Xms:512m -XX:MinPermSize=128m"
#ulimit -n 400000
echo "" > nohup.out
#echo JAVA_HOME=$JAVA_HOME
#echo PATH=$PATH
#echo CLASSPATH=$CLASSPATH
#echo JVM_ARGS=$JVM_ARGS
nohup $JAVA_HOME/bin/java -cp $CLASSPATH:$RUN_PATH $RUN_MAIN &
解决 : /bin/bash^M: bad interpreter: No such file or directory
http://blog.csdn.net/esther0401/article/details/7361496