centos7升级到centos8

只负责记录, 升级出了问题责任自负.

yum -y install epel-release yum-utils rpmconf  dnf
yum remove 

# 
# package-cleanup --leaves
# package-cleanup --orphans
#

dnf -y remove yum yum-metadata-parser libsysfs  
dnf upgrade -y
dnf upgrade -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/{centos-release-8.1-1.1911.0.8.el8.x86_64.rpm,centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm,centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm}

dnf upgrade -y epel-release
dnf clean all
rpm -e `rpm -q kernel`
rpm -e --nodeps sysvinit-tools
dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
dnf -y install kernel-core
dnf -y groupupdate Core "Minimal Install"
cat /etc/redhat-release


centos8的三个包centos-release centos-gpg-keys centos-repos版本会有变动, 操作的时候需要注意选择更新.

也可以不用http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/ ,选用centos vault的库.


centos大版本升级6到7

从6升级到7,建议按步骤走一遍弄个机器测试升级,玩坏了自己买单。

#!/bin/bash

cat>/root/fix.sh<<EOF
rm -f /lib64/libpcre.so.0 /usr/lib64/libpcre.so.0 /usr/lib64/libsasl2.so.2 /lib64/libsasl2.so.2
ln -s /usr/lib64/libpcre.so.1.2.0 /lib64/libpcre.so.0
ln -s /usr/lib64/libpcre.so.1.2.0 /usr/lib64/libpcre.so.0
ln -s /usr/lib64/libsasl2.so.3.0.0  /usr/lib64/libsasl2.so.2
ln -s /usr/lib64/libsasl2.so.3.0.0  /lib64/libsasl2.so.2
yum -y downgrade  grep
mv  root/fix.sh root/fix.txt
EOF
chmod 755 /root/fix.sh
echo "/root/fix.sh">> /etc/rc.local

cat>/etc/yum.repos.d/upgradetool.repo<<EOF
[upg]
name=CentOS-$releasever - Upgrade Tool
baseurl=http://buildlogs.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
EOF
    
yum -y erase openscap
yum -y install redhat-upgrade-tool preupgrade-assistant-contents --disablerepo=base
preupg -s CentOS6_7 <<EOF
y
EOF
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
centos-upgrade-tool-cli --network 7 --instrepo=http://vault.centos.org/centos/7.2.1511/os/x86_64/ <<EOF
y
EOF
reboot

centos编译升级gcc版本

yum -y -q install gcc gcc-c++ glibc-static libstdc++-static kernel-devel lbzip2
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.2.0/gcc-9.2.0.tar.gz  -O -|tar xz
cd gcc-9.2.0
./contrib/download_prerequisites
./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make
make install

Centos7下通过grub2引导进行网络自动重装系统

Shell大致流程

1.获取网络IP配置参数

2.写入自定义grub引导内核

 2.1 http://103.xxx.xxx.xxx/kickstart.php/rh?end=1&amp;ethworkaround=1是预设定的anaconda-ks自动响应安装脚本。
3.修改grub默认配置参数等待时间和指定引导顺序。

4. 重新生成grub2配置

5.重启等待安装完成。

最后建议在NoVNC或者IPMi辅助的情况下使用。

vmlinuz的网络参数还有一种写法是 ip=address::gateway:netmask:hostname:interface:method

getETH=`ip -4 route list 0/0 |awk '{ print $5 }'`
getGATEWAY=`ip -4 route list 0/0 |awk '{ print $3 }'`
getNETMASK=`ifconfig $getETH | awk '/mask /{ print $4;}'`
getIPADDR=`ifconfig $getETH | awk '/inet /{ print $2;}'`

cat>>/etc/grub.d/40_custom<<EOF
menuentry 'Netinstall' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod xfs
set root='hd0,gpt2'
linux16 /vmlinuz ro ks='http://103.xxx.xxx.xxx/kickstart.php/rh?end=1&ethworkaround=1' net.ifnames=0 biosdevname=0 crashkernel=auto gateway=$getGATEWAY ip=$getIPADDR nameserver=8.8.8.8 ksdevice=$getETH  netmask=$getNETMASK
initrd16 /initrd.img
}
EOF
 sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=60/g'  /etc/default/grub
 sed -i 's/GRUB_DEFAULT=saved/GRUB_DEFAULT=Netinstall/g'  /etc/default/grub
 grub2-mkconfig --output=/boot/grub2/grub.cfg
 reboot

Centos7下Solusvm母鸡部署小记

存本地文档里面,每次都懒得翻干脆贴上来

#加epel源和安装常用的包
yum install epel-release -y -q
yum install -y -q net-tools -y fail2ban iftop wget tcpdunmp  zip unzip  wget ntp rsync  vim-enhanced
systemctl enable fail2ban
#设置时区
/etc/init.d/ntpd stop
cat >/etc/sysconfig/clock<<EOF
ZONE="Asia/Shanghai"
UTC=false
ARC=false
EOF
cat /usr/share/zoneinfo/Asia/Shanghai>/etc/localtime
ntpdate us.pool.ntp.org
echo "ntpdate us.pool.ntp.org">>/etc/rc.local
date
hwclock --systohc
#开始安装solusvm被控端
wget https://files.soluslabs.com/install.sh
sh install.sh<<EOF
2
EOF
#(选装)升级e2fsprogs
curl -s http://dl.kvm.la/shell/e2fspros.el6.sh|bash

阅读剩余部分...