centos使用总结

如未特殊说明表示使用CentOS 7.6 1810

最小化安装IP配置

修改 /etc/sysconfig/network-scripts/ifcfg-xxx 文件

1
2
3
4
5
6
7
8
9
TYPE=Ethernet
BOOTPROTO=static #网卡引导方式 static/DHCP
ONBOOT=yes #网卡开机启动
IPADDR=192.168.0.150
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
HWADDR=xx:xx:xx:xx:xx:xx
DNS1=x.x.x.x
DNS2=x.x.x.x

然后重启网络服务 systemctl restart network

配置国内镜像源

1
2
3
4
5
cat /etc/centos-release
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache

epel扩展源

yum命令

工具安装与配置

openjdk安装

通过yum工具安装的位置为 /usr/lib/jvm/java-xxx

1
2
3
yum install java-11-openjdk-devel.x86_64
echo "export JAVA_HOME=/usr/lib/jvm/java-11-openjdk" >> /etc/profile
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile

docker安装