centos7脚本记录

发布于 2021-01-12  108 次阅读


配置网络连接

sed -i \'/BOOTPROTO/s/dhcp/static/g\' /etc/sysconfig/network-scripts/ifcfg-eno16777736
sed -i \'/ONBOOT/s/no/yes/g\' /etc/sysconfig/network-scripts/ifcfg-eno16777736
sed -i \'1a IPADDR=192.168.25.12\' /etc/sysconfig/network-scripts/ifcfg-eno16777736
sed -i \'1a GATEWAY=192.168.25.1\' /etc/sysconfig/network-scripts/ifcfg-eno16777736
sed -i \'1a NETMAKE=255.255.255.0\' /etc/sysconfig/network-scripts/ifcfg-eno16777736
sed -i \'1a DNS=8.8.8.8\' /etc/sysconfig/network-scripts/ifcfg-eno16777736
systemctl restart network

配置yum


mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom

sed -i \'s/media/mnt/g\' /etc/yum.repos.d/CentOS-Media.repo
sed -i \'17,18d\' /etc/yum.repos.d/CentOS-Media.repo
sed -i \'s/CentOS/cdrom/g\' /etc/yum.repos.d/CentOS-Media.repo
sed -i \'/gpgcheck/s/1/0/g\' /etc/yum.repos.d/CentOS-Media.repo
sed -i \'/enabled/s/0/1/g\' /etc/yum.repos.d/CentOS-Media.repo

cd /etc/yum.repos.d/
rm -rf CentOS-Base.repo CentOS-fasttrack.repo CentOS-CR.repo CentOS-Vault.repo CentOS-Debuginfo.repo CentOS-Sources.repo
cd

yum clean all
yum makecache

配置其他

yum install -y gcc*

sed -i \'/SELINUX/s/enforcing/disabled/g\' /etc/sysconfig/selinux

systemctl stop firewalld.service
systemctl disable firewalldw

配置httpd


不开心的事情说出来或者遗忘掉,不要让它变成一根刺。