Centos体系原地升级openEuler(详细攻略)

打印 上一主题 下一主题

主题 943|帖子 943|积分 2829

目次
一. 环境准备
二. 下载x2openEuler 
三. 准备待升级主机 
四. 原地升级到openEuler


一. 环境准备


现在可升级centos版本从6.8-8.2 
(本实验一共需要两台,一太作为升级工具主机,一台作为被升级openEuler体系主机)
选择一台192.168.226.110主机作为工具主机操纵,举行时间同步与关闭防火墙和selinux。
主机名:localhost192.168.226.110centos7-2009-mini2焦点4G内存,20G磁盘
  1. [root@localhost ~]# cat /etc/os-release
  2. NAME="CentOS Linux"
  3. VERSION="7 (Core)"
  4. ID="centos"
  5. ID_LIKE="rhel fedora"
  6. VERSION_ID="7"
  7. PRETTY_NAME="CentOS Linux 7 (Core)"
  8. ANSI_COLOR="0;31"
  9. CPE_NAME="cpe:/o:centos:centos:7"
  10. HOME_URL="https://www.centos.org/"
  11. BUG_REPORT_URL="https://bugs.centos.org/"
  12. CENTOS_MANTISBT_PROJECT="CentOS-7"
  13. CENTOS_MANTISBT_PROJECT_VERSION="7"
  14. REDHAT_SUPPORT_PRODUCT="centos"
  15. REDHAT_SUPPORT_PRODUCT_VERSION="7"
  16. [root@localhost ~]# cat /etc/centos-release
  17. CentOS Linux release 7.9.2009 (Core)
复制代码

二. 下载x2openEuler 


配置阿里云镜像源
  1. rm -rf /etc/yum.repos.d/*
  2. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  3. curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
  4. yum clean all
  5. yum makecache
复制代码
 下载工具
官网:迁徙下载 | Linux服务器体系迁徙 | openEuler社区官网

上传至虚拟机,这里我上传好了
  1. # 下载上传工具包
  2. [root@localhost ~]# yum install -y lrzsz
  3. # 上传到当前目录中
  4. [root@localhost ~]# rz -E
  5. [root@localhost ~]# ll
  6. 总用量 564772
  7. -rw-------. 1 root root      1417 5月  12 19:34 anaconda-ks.cfg
  8. -rw-r--r--  1 root root 578320348 8月  11 22:19 x2openEuler-core-3.0.0-20240125.x86_64.rpm
  9. [root@localhost ~]# yum install -y x2openEuler-core-3.0.0-20240125.x86_64.rpm
复制代码
  1. [root@localhost ~]# cd /usr/local/x2openEuler/portal/service/
  2. [root@localhost service]# ll
  3. 总用量 84
  4. -rwxr-x--- 1 root root 14616 1月  25 2024 change_ip_x2openEuler.sh
  5. -rwxr-x--- 1 root root    57 1月  25 2024 const.conf
  6. -rwxr-x--- 1 root root  1897 1月  25 2024 delete_file.sh
  7. -rwxr-x--- 1 root root   579 1月  25 2024 gunicorn_x2openEuler.service
  8. -rwxr-x--- 1 root root  6143 1月  25 2024 mariadb.sh
  9. -rwxr-x--- 1 root root   591 1月  25 2024 nginx_x2openEuler.service
  10. -rwxr-x--- 1 root root   784 1月  25 2024 service_daemon.sh
  11. -rwxr-x--- 1 root root   237 1月  25 2024 service_gunicorn.sh
  12. -rwxr-x--- 1 root root 16497 1月  25 2024 service_init.sh
  13. -rwxr-x--- 1 root root  3237 1月  25 2024 service_nginx.sh
  14. -rwxr-x--- 1 root root  1614 1月  25 2024 set_ssh_host_key_check_config.sh
  15. -rwxr-x--- 1 root root  3107 1月  25 2024 update_db_pwd.sh
  16. -rwxr-x--- 1 root root   828 1月  25 2024 upgrade_migrate_data.sh
复制代码

  1. [root@localhost service]# bash service_init.sh
  2. Start the MariaDB custom configuration for the use of the x2openEuler tool.
  3. Has MariaDB been installed on the server and can be used properly? [Y/n] (default: n)  # 直接回车,使用默认,会自动安装 MariaDB   
  4. Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
  5. MariaDB is active.
  6. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  7.       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
  8. In order to log into MariaDB to secure it, we'll need the current
  9. password for the root user.  If you've just installed MariaDB, and
  10. you haven't set the root password yet, the password will be blank,
  11. so you should just press enter here.
  12. Enter current password for root (enter for none):
  13. OK, successfully used password, moving on...
  14. Setting the root password ensures that nobody can log into the MariaDB
  15. root user without the proper authorisation.
  16. Set root password? [Y/n] Y    # 这里输入Y确认设置root密码
  17. New password:                 # 输出你要设置的数据库root密码
  18. Re-enter new password:        # 重复输入密码
  19. Password updated successfully!
  20. Reloading privilege tables..
  21. ... Success!
  22. By default, a MariaDB installation has an anonymous user, allowing anyone
  23. to log into MariaDB without having to have a user account created for
  24. them.  This is intended only for testing, and to make the installation
  25. go a bit smoother.  You should remove them before moving into a
  26. production environment.
  27. Remove anonymous users? [Y/n] Y     # 输入Y,确认删除匿名用户
  28. ... Success!
  29. Normally, root should only be allowed to connect from 'localhost'.  This
  30. ensures that someone cannot guess at the root password from the network.
  31. Disallow root login remotely? [Y/n] n       # 输入n,不禁止root用户远程登录
  32. ... skipping.
  33. By default, MariaDB comes with a database named 'test' that anyone can
  34. access.  This is also intended only for testing, and should be removed
  35. before moving into a production environment.
  36. Remove test database and access to it? [Y/n] Y 输入Y,确认删除测试数据库
  37. - Dropping test database...
  38. ... Success!
  39. - Removing privileges on test database...
  40. ... Success!
  41. Reloading the privilege tables will ensure that all changes made so far
  42. will take effect immediately.
  43. Reload privilege tables now? [Y/n] Y         # 输入Y,确认重新加载特权表
  44. ... Success!
  45. Cleaning up...
  46. All done!  If you've completed all of the above steps, your MariaDB
  47. installation should now be secure.
  48. Thanks for using MariaDB!
  49. Enter the password of the root user of the MariaDB again:            # 这里需要再次输入登录数据库root的密码
  50. Set the password of the x2openEuler user for MariaDB:                # 设置数据库x2openEuler用户的密码
  51. If the selected database already exists, it will be overwritten.
  52. Use default x2openEulerDb database? [Y/n] (default: Y)               # 这里直接回车使用默认
  53. MariaDB is configured successfully.
  54. If authentication is enabled,
  55. the SSH connection fails after the fingerprint of the machine changes.
  56. Please confirm whether public key authentication is not required for SSH connection(y/n default: n):             # 回车使用默认
  57. Start Nginx service and Gunicorn service
  58. Ip address list:
  59. sequence_number         ip_address              device
  60. [1]                     192.168.226.110               ens33
  61. Enter the sequence number of listed ip as web server ip(default: 1):        # 直接回车使用默认
  62. Set the web server IP address 192.168.226.110
  63. Please enter HTTPS port(default: 18082):                          # 直接回车使用默认
  64. The HTTPS port 18082 is valid.  Set the HTTPS port to 18082 (y/n default: y):      # 直接回车使用默认
  65. Set the HTTPS port 18082
  66. Please enter gunicorn port(default: 18080):                     
  67. The GUNICORN port 18080 is valid.  Set the GUNICORN port to 18080 (y/n default: y):     # 直接回车使用默认
  68. Set the GUNICORN port 18080
  69. The Nginx and Gunicorn ports are set up successfully.
  70. Installing the django dependent environment.
  71. The django dependency environment is installed successfully.
  72. ......
  73. ......
  74. ......
复制代码

如上图则安装成功。 
  1. [root@localhost service]# ss -tnlp
  2. State       Recv-Q Send-Q                                                       Local Address:Port                                                                      Peer Address:Port              
  3. LISTEN      0      128                                                              127.0.0.1:18080                                                                                *:*                   users:(("gunicorn",pid=4342,fd=7),("gunicorn",pid=4322,fd=7))
  4. LISTEN      0      128                                                        192.168.226.110:18082                                                                                *:*                   users:(("nginx",pid=4268,fd=8),("nginx",pid=4267,fd=8),("nginx",pid=4266,fd=8),("nginx",pid=4265,fd=8),("nginx",pid=4264,fd=8),("nginx",pid=4263,fd=8))
  5. LISTEN      0      50                                                                       *:3306                                                                                 *:*                   users:(("mysqld",pid=2596,fd=14))
  6. LISTEN      0      128                                                                      *:22                                                                                   *:*                   users:(("sshd",pid=859,fd=3))
  7. LISTEN      0      100                                                              127.0.0.1:25                                                                                   *:*                   users:(("master",pid=1058,fd=13))
  8. LISTEN      0      128                                                                   [::]:22                                                                                [::]:*                   users:(("sshd",pid=859,fd=4))
  9. LISTEN      0      100                                                                  [::1]:25                                                                                [::]:*                   users:(("master",pid=1058,fd=14))
复制代码
如上图就安装成功了,浏览器访问终端中提示的页面链接查看: https://192.168.226.110:18082/x2openEuler/#/login
 
初次登陆需要设置管理员用户密码 
 

三. 准备待升级主机 


将192.168.226.120主构造闭防火墙和selinux,举行时间同步,固定IP不变。
主机名:localhost192.168.226.120192.168.226.1102焦点4G内存,20G磁盘
  1. [root@localhost ~]# cat /etc/os-release
  2. NAME="CentOS Linux"
  3. VERSION="7 (Core)"
  4. ID="centos"
  5. ID_LIKE="rhel fedora"
  6. VERSION_ID="7"
  7. PRETTY_NAME="CentOS Linux 7 (Core)"
  8. ANSI_COLOR="0;31"
  9. CPE_NAME="cpe:/o:centos:centos:7"
  10. HOME_URL="https://www.centos.org/"
  11. BUG_REPORT_URL="https://bugs.centos.org/"
  12. CENTOS_MANTISBT_PROJECT="CentOS-7"
  13. CENTOS_MANTISBT_PROJECT_VERSION="7"
  14. REDHAT_SUPPORT_PRODUCT="centos"
  15. REDHAT_SUPPORT_PRODUCT_VERSION="7"
  16. [root@localhost ~]# cat /etc/centos-release
  17. CentOS Linux release 7.9.2009 (Core)
复制代码
 
配置阿里云的镜像源
  1. rm -rf /etc/yum.repos.d/*
  2. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  3. curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
  4. yum clean all
  5. yum makecache
复制代码
创建一些文件模拟有数据存在
  1. [root@localhost ~]# ll
  2. 总用量 24
  3. -rw-------. 1 root root  1417 5月  12 19:34 anaconda-ks.cfg
  4. -rw-r--r--. 1 root root 12430 8月  11 23:23 tty.sh
  5. -rw-r--r--. 1 root root   150 8月  11 23:26 yinyue.mp3
复制代码

四. 原地升级到openEuler



在待升级主机上查看:
  1. [root@localhost ~]# ip a
  2. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  3.     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  4.     inet 127.0.0.1/8 scope host lo
  5.        valid_lft forever preferred_lft forever
  6.     inet6 ::1/128 scope host
  7.        valid_lft forever preferred_lft forever
  8. 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
  9.     link/ether 00:0c:29:87:e0:73 brd ff:ff:ff:ff:ff:ff
  10.     inet 192.168.226.120/24 brd 192.168.226.255 scope global noprefixroute ens33
  11.        valid_lft forever preferred_lft forever
  12.     inet6 fe80::d39e:4dcb:77e4:2e1/64 scope link dadfailed tentative noprefixroute
  13.        valid_lft forever preferred_lft forever
  14.     inet6 fe80::6be7:95e9:3752:4825/64 scope link noprefixroute
  15.        valid_lft forever preferred_lft forever
  16. [root@localhost ~]# getenforce
  17. Disabled
  18. [root@localhost ~]# systemctl status firewalld
  19. ● firewalld.service - firewalld - dynamic firewall daemon
  20.    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  21.    Active: inactive (dead)
  22.      Docs: man:firewalld(1)
  23. [root@localhost ~]# cat /etc/os-release
  24. NAME="openEuler"
  25. VERSION="20.03 (LTS-SP1)"
  26. ID="openEuler"
  27. VERSION_ID="20.03"
  28. PRETTY_NAME="openEuler 20.03 (LTS-SP1)"
  29. ANSI_COLOR="0;31"
  30. [root@localhost ~]# hostnamectl
  31.    Static hostname: localhost.localdomain
  32.          Icon name: computer-vm
  33.            Chassis: vm
  34.         Machine ID: 6e651e4200034fa4816fbf148b66fa60
  35.            Boot ID: 003f89b590064c168035b1247711b946
  36.     Virtualization: vmware
  37.   Operating System: openEuler 20.03 (LTS-SP1)
  38.             Kernel: Linux 4.19.90-2405.5.0.0251.oe1.x86_64
  39.       Architecture: x86-64
  40. 查看我之前传入的文件数据是否损坏
  41. [root@localhost ~]# ll
  42. 总用量 24
  43. -rw-------. 1 root root  1417  5月 12 19:34 anaconda-ks.cfg
  44. -rw-r--r--. 1 root root 12430  8月 11 23:23 tty.sh
  45. -rw-r--r--. 1 root root   150  8月 11 23:26 yinyue.mp3
  46. [root@localhost ~]# cat tty.sh
  47. #!/bin/bash
  48. # **********************************************************
  49. # * Filename      : elk1.9.sh
  50. # * Author        : Elk
  51. # * Email         : zzdict@gmail.com / elk_deer@foxmail.com
  52. # * Create time   : 2024-04-25 10:12
  53. # * Description   : 不合理设置喊我,持续更新维护中......
  54. # **********************************************************
  55. start_time=$(date +%s)
  56. keep_going=true
  57. yum install -y beep &> /dev/null
  58. while $keep_going; do
  59. RED='\033[0;31m'
  60. GREEN='\033[0;32m'
  61. YELLOW='\033[1;33m'
  62. BLUE="\033[34m"
  63. CYAN='\033[0;36m'
  64. MAGENTA='\033[0;35m'
  65. BOLD='\033[1m'
  66. ......
  67. ......
  68. ......
  69. 经验证,数据完整并正常使用 我的脚本依旧运行使用
  70. [root@localhost ~]# sh tty.sh
  71. ***************** ELK *****************
  72.   [1].  防火墙DOWN
  73.   [2].  临时关闭SELinux
  74.   [3].  配置SELinux永久关闭
  75.   [4].  配置阿里源
  76.   [5].  配置本地源
  77.   [6].  一键安装常用工具包与系统分析工具
  78.   [7].  自定义静态IP
  79.   [8].  MySQL-8.0
  80.   [9].  MySQL-5.7
  81.   [10]. 创建MySQL远程账户
  82.   [11]. Fuck工具
  83.   [12]. 设置时区并同步时间
  84.   [13]. 设置系统最大打开文件数
  85.   [14]. 系统内核优化
  86.   [15]. 减少SWAP使用
  87.   [q]. 退出
  88. *************** Automation ***************
  89. 请选择模块:
复制代码
 

清理操纵会执行清理环境操纵将删除/.osbak目次下的备份文件,并卸载x2openEuler-upgrade软件。
这个清理根据需要自行选择,这里我没啥用就点击清理测试一下

 


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

张国伟

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表