Mac系统配置CentOS服务器
2017-12-21 本文已影响50人
JYGod丶
终端连接服务器
ssh root@XXX.XXX.XXX.XX //公网IP
遇到错误
ssh: connect to host XXX.XX.XX.XX port 22: Operation timed out
排查
PING 一下看看能不能ping得通
telnet XXX.XX.XXX.XX 22
结果丢包了
Trying XXX.XX.XX.XX...
telnet: connect to address XXX.XX.XX.XX: Operation timed out
telnet: Unable to connect to remote host
使用链路测试工具:
参考:链路测试工具使用说明
经过一番折腾,发现是阿里云服务器需要配置安全组规则...沃日太坑爹了。
设置好折后就OK能连上了。
ssh -p 22 root@XXX.XX.XX.XX
The authenticity of host 'XXX.XX.XX.XX (XXX.XX.XX.XX)' can't be established.
ECDSA key fingerprint is SHA256:oZmWDma0QVlX+oVAWj8YP0kuhGH4mGSqTBJfCIF7F1g.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'XXX.XX.XX.XX' (ECDSA) to the list of known hosts.
root@47.94.81.13's password:
Last login: Wed Dec 20 16:59:42 2017
Welcome to Alibaba Cloud Elastic Compute Service !
[root@izsnbdeue3bgqyz ~]#
Java环境
下载jdk,然后复制到服务器中
scp XXXX.tar.gz root@XXX.XX.XX.XX:/usr/bin
解压
tar zxvf XXXX.tar.gz
配置环境变量
vi /etc/profile
添加
export JAVA_HOME=/usr/bin/jdk1.8.0_151
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
加载设置的变量
source /etc/profile
测试一下:
[root@izsnbdeue3bgqyz ~]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
处理短时掉线问题
vim /etc/ssh/ssh_config
在里面加入:
TCPKeepAlive yes
ClientAliveInterval 3
重启即可
service sshd restart