新centos6 静态ip 放行端口 hosts主机名 jdk环境变量

0 jdk 环境变量 

vi  /etc/profile

在尾部增加如下代码:

#JDK全局环境变量配置
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin

1.静态IP 

修改下列项的值

BOOTPROTO="static"
IPV6INIT="no"
NM_CONTROLLED="yes"
ONBOOT="yes"

IPADDR="192.168.177.130"
NETMASK="255.255.255.0"
GATEWAY="192.168.177.2" #Wangguan
#NETWORK="192.168.177.0" #Ziwang IP
#BCAST="192.168.177.255"
#BROADCAST="192.168.177.255"
DNS1="114.114.114.114"

2.修改network

 vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=trsr01

3 放行端口

  

列出所有端口   netstat -ntlp   1、开启端口(以80端口为例)         方法一:            /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT   写入修改            /etc/init.d/iptables save   保存修改           service iptables restart    重启防火墙,修改生效          方法二:          vi /etc/sysconfig/iptables  打开配置文件加入如下语句:          -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT   重启防火墙,修改完成       2、关闭端口        方法一:            /sbin/iptables -I INPUT -p tcp --dport 80 -j DROP   写入修改            /etc/init.d/iptables save   保存修改           service iptables restart    重启防火墙,修改生效          方法二:          vi /etc/sysconfig/iptables  打开配置文件加入如下语句:          -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j DROP   重启防火墙,修改完成       3、查看端口状态         /etc/init.d/iptables status     4.关闭防火墙 chkconfig –level 35 iptables off #此方法源自网络,未实验,安全考虑拒绝使用此方法

4 centos6 yum换源

  vim /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

  

5 上传下载工具

  

 

上一篇:azure VM backup delete 失败soft delete


下一篇:Ansible之二playbook