firewalld的基本使用
启动服务: systemctl start firewalld
关闭服务: systemctl stop firewalld
查看状态: systemctl status firewalld
开机禁用: systemctl disable firewalld
开机启用: systemctl enable firewalld
SELINUX关闭
# sestatus
SELinux status: enabled
Current mode: enforcing #临时关闭后状态为: permissive
setenforce 0
1.修改配置文件
# vim /etc/selinux/config
...
SELINUX=disabled #将SELINU置为disabled
...
2.执行如下命令:
# sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
# sestatus
SELinux status: disabled
IPV4设置
BOOTPROTO="static" #static-手动设置IP, dhcp-自动分配IP
ONBOOT="yes" #网卡开机启动
#如选择手动设置IP, 添加如下几项:
IPADDR=192.168.52.93 #静态IP
GATEWAY=192.168.52.1 #默认网关
NETMASK=255.255.255.0 #子网掩码
DNS1=192.168.7.1 #DNS 配置
禁用IPV6
使用sysctl设置禁用IPv6(无需重新启动)
# ifconfig -a | grep inet6
inet6 fe80::211:aff:fe6a:9de4 prefixlen 64 scopeid 0x20
inet6 ::1 prefixlen 128 scopeid 0x10[host]
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
# 或者执行
sed -i '$ a\net.ipv6.conf.all.disable_ipv6 = 1\nnet.ipv6.conf.default.disable_ipv6 = 1' /etc/sysctl.conf
# sysctl -p
# 确保文件/etc/ssh/sshd_config包含AddressFamily inet一行,以避免在使用sysctl方法时破坏SSH Xforwarding
#vi / etc / ssh / sshd_config
....
AddressFamily inet
....
#systemctl restart sshd
更新源
# mv /etc/yum.repos.d/CentOS7-Base.repo CentOS7-Base.repo.bak
# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
# mv CentOS7-Base-163.repo CentOS7-Base.repo
# yum clean all
# yum makecache
安装EPEL源
安装
# yum -y install epel-release
更新缓存
# yum clean all && yum makecache
安装C/C++编译器及开发库
#安装gcc g++
yum -y install gcc gcc-c++
#安装glibc 32位和64位, libstdc++ 32位和64位
yum -y install glibc-devel.i686 glibc-devel.x86_64
yum -y install libstdc++-devel.i686 libstdc++-devel.x86_64
C/C++编译相关环境变量
添加至/etc/profile或者用户家目录下的 .bash_profile, 编辑后执行: source [profile文件]使生效
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/mysql
export C_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/mysql
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/mysql
JAVA相关环境变量
export JAVA_HOME=/root/software/jdk1.6.0_45
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$PATH:$JAVA_HOME/bin:$HOME/bin:$HOME/.local/bin
mysql数据库
mysqlServer 8.0 官方 yum方式安装
mysql > use mysql;
mysql > update user set user.host='%' where user.user='root';
mysql > FLUSH PRIVILEGES;