目次
一. 环境准备
二. 下载x2openEuler
三. 准备待升级主机
四. 原地升级到openEuler
一. 环境准备
现在可升级centos版本从6.8-8.2
(本实验一共需要两台,一太作为升级工具主机,一台作为被升级openEuler体系主机)
选择一台192.168.226.110主机作为工具主机操纵,举行时间同步与关闭防火墙和selinux。
主机名:localhost | 192.168.226.110 | centos7-2009-mini | 2焦点4G内存,20G磁盘 |
- [root@localhost ~]# cat /etc/os-release
- NAME="CentOS Linux"
- VERSION="7 (Core)"
- ID="centos"
- ID_LIKE="rhel fedora"
- VERSION_ID="7"
- PRETTY_NAME="CentOS Linux 7 (Core)"
- ANSI_COLOR="0;31"
- CPE_NAME="cpe:/o:centos:centos:7"
- HOME_URL="https://www.centos.org/"
- BUG_REPORT_URL="https://bugs.centos.org/"
- CENTOS_MANTISBT_PROJECT="CentOS-7"
- CENTOS_MANTISBT_PROJECT_VERSION="7"
- REDHAT_SUPPORT_PRODUCT="centos"
- REDHAT_SUPPORT_PRODUCT_VERSION="7"
- [root@localhost ~]# cat /etc/centos-release
- CentOS Linux release 7.9.2009 (Core)
复制代码
二. 下载x2openEuler
配置阿里云镜像源
- rm -rf /etc/yum.repos.d/*
- curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
- curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
- yum clean all
- yum makecache
复制代码 下载工具
官网:迁徙下载 | Linux服务器体系迁徙 | openEuler社区官网
上传至虚拟机,这里我上传好了
- # 下载上传工具包
- [root@localhost ~]# yum install -y lrzsz
- # 上传到当前目录中
- [root@localhost ~]# rz -E
- [root@localhost ~]# ll
- 总用量 564772
- -rw-------. 1 root root 1417 5月 12 19:34 anaconda-ks.cfg
- -rw-r--r-- 1 root root 578320348 8月 11 22:19 x2openEuler-core-3.0.0-20240125.x86_64.rpm
- [root@localhost ~]# yum install -y x2openEuler-core-3.0.0-20240125.x86_64.rpm
复制代码- [root@localhost ~]# cd /usr/local/x2openEuler/portal/service/
- [root@localhost service]# ll
- 总用量 84
- -rwxr-x--- 1 root root 14616 1月 25 2024 change_ip_x2openEuler.sh
- -rwxr-x--- 1 root root 57 1月 25 2024 const.conf
- -rwxr-x--- 1 root root 1897 1月 25 2024 delete_file.sh
- -rwxr-x--- 1 root root 579 1月 25 2024 gunicorn_x2openEuler.service
- -rwxr-x--- 1 root root 6143 1月 25 2024 mariadb.sh
- -rwxr-x--- 1 root root 591 1月 25 2024 nginx_x2openEuler.service
- -rwxr-x--- 1 root root 784 1月 25 2024 service_daemon.sh
- -rwxr-x--- 1 root root 237 1月 25 2024 service_gunicorn.sh
- -rwxr-x--- 1 root root 16497 1月 25 2024 service_init.sh
- -rwxr-x--- 1 root root 3237 1月 25 2024 service_nginx.sh
- -rwxr-x--- 1 root root 1614 1月 25 2024 set_ssh_host_key_check_config.sh
- -rwxr-x--- 1 root root 3107 1月 25 2024 update_db_pwd.sh
- -rwxr-x--- 1 root root 828 1月 25 2024 upgrade_migrate_data.sh
复制代码
- [root@localhost service]# bash service_init.sh
- Start the MariaDB custom configuration for the use of the x2openEuler tool.
- Has MariaDB been installed on the server and can be used properly? [Y/n] (default: n) # 直接回车,使用默认,会自动安装 MariaDB
- Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
- MariaDB is active.
- NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
- SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
- In order to log into MariaDB to secure it, we'll need the current
- password for the root user. If you've just installed MariaDB, and
- you haven't set the root password yet, the password will be blank,
- so you should just press enter here.
- Enter current password for root (enter for none):
- OK, successfully used password, moving on...
- Setting the root password ensures that nobody can log into the MariaDB
- root user without the proper authorisation.
- Set root password? [Y/n] Y # 这里输入Y确认设置root密码
- New password: # 输出你要设置的数据库root密码
- Re-enter new password: # 重复输入密码
- Password updated successfully!
- Reloading privilege tables..
- ... Success!
- By default, a MariaDB installation has an anonymous user, allowing anyone
- to log into MariaDB without having to have a user account created for
- them. This is intended only for testing, and to make the installation
- go a bit smoother. You should remove them before moving into a
- production environment.
- Remove anonymous users? [Y/n] Y # 输入Y,确认删除匿名用户
- ... Success!
- Normally, root should only be allowed to connect from 'localhost'. This
- ensures that someone cannot guess at the root password from the network.
- Disallow root login remotely? [Y/n] n # 输入n,不禁止root用户远程登录
- ... skipping.
- By default, MariaDB comes with a database named 'test' that anyone can
- access. This is also intended only for testing, and should be removed
- before moving into a production environment.
- Remove test database and access to it? [Y/n] Y 输入Y,确认删除测试数据库
- - Dropping test database...
- ... Success!
- - Removing privileges on test database...
- ... Success!
- Reloading the privilege tables will ensure that all changes made so far
- will take effect immediately.
- Reload privilege tables now? [Y/n] Y # 输入Y,确认重新加载特权表
- ... Success!
- Cleaning up...
- All done! If you've completed all of the above steps, your MariaDB
- installation should now be secure.
- Thanks for using MariaDB!
- Enter the password of the root user of the MariaDB again: # 这里需要再次输入登录数据库root的密码
- Set the password of the x2openEuler user for MariaDB: # 设置数据库x2openEuler用户的密码
- If the selected database already exists, it will be overwritten.
- Use default x2openEulerDb database? [Y/n] (default: Y) # 这里直接回车使用默认
- MariaDB is configured successfully.
- If authentication is enabled,
- the SSH connection fails after the fingerprint of the machine changes.
- Please confirm whether public key authentication is not required for SSH connection(y/n default: n): # 回车使用默认
- Start Nginx service and Gunicorn service
- Ip address list:
- sequence_number ip_address device
- [1] 192.168.226.110 ens33
- Enter the sequence number of listed ip as web server ip(default: 1): # 直接回车使用默认
- Set the web server IP address 192.168.226.110
- Please enter HTTPS port(default: 18082): # 直接回车使用默认
- The HTTPS port 18082 is valid. Set the HTTPS port to 18082 (y/n default: y): # 直接回车使用默认
- Set the HTTPS port 18082
- Please enter gunicorn port(default: 18080):
- The GUNICORN port 18080 is valid. Set the GUNICORN port to 18080 (y/n default: y): # 直接回车使用默认
- Set the GUNICORN port 18080
- The Nginx and Gunicorn ports are set up successfully.
- Installing the django dependent environment.
- The django dependency environment is installed successfully.
- ......
- ......
- ......
复制代码
如上图则安装成功。
- [root@localhost service]# ss -tnlp
- State Recv-Q Send-Q Local Address:Port Peer Address:Port
- LISTEN 0 128 127.0.0.1:18080 *:* users:(("gunicorn",pid=4342,fd=7),("gunicorn",pid=4322,fd=7))
- 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))
- LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=2596,fd=14))
- LISTEN 0 128 *:22 *:* users:(("sshd",pid=859,fd=3))
- LISTEN 0 100 127.0.0.1:25 *:* users:(("master",pid=1058,fd=13))
- LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=859,fd=4))
- 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不变。
主机名:localhost | 192.168.226.120 | 192.168.226.110 | 2焦点4G内存,20G磁盘 |
- [root@localhost ~]# cat /etc/os-release
- NAME="CentOS Linux"
- VERSION="7 (Core)"
- ID="centos"
- ID_LIKE="rhel fedora"
- VERSION_ID="7"
- PRETTY_NAME="CentOS Linux 7 (Core)"
- ANSI_COLOR="0;31"
- CPE_NAME="cpe:/o:centos:centos:7"
- HOME_URL="https://www.centos.org/"
- BUG_REPORT_URL="https://bugs.centos.org/"
- CENTOS_MANTISBT_PROJECT="CentOS-7"
- CENTOS_MANTISBT_PROJECT_VERSION="7"
- REDHAT_SUPPORT_PRODUCT="centos"
- REDHAT_SUPPORT_PRODUCT_VERSION="7"
- [root@localhost ~]# cat /etc/centos-release
- CentOS Linux release 7.9.2009 (Core)
复制代码
配置阿里云的镜像源
- rm -rf /etc/yum.repos.d/*
- curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
- curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
- yum clean all
- yum makecache
复制代码 创建一些文件模拟有数据存在
- [root@localhost ~]# ll
- 总用量 24
- -rw-------. 1 root root 1417 5月 12 19:34 anaconda-ks.cfg
- -rw-r--r--. 1 root root 12430 8月 11 23:23 tty.sh
- -rw-r--r--. 1 root root 150 8月 11 23:26 yinyue.mp3
复制代码
四. 原地升级到openEuler
              
在待升级主机上查看:
- [root@localhost ~]# ip a
- 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
- link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
- inet 127.0.0.1/8 scope host lo
- valid_lft forever preferred_lft forever
- inet6 ::1/128 scope host
- valid_lft forever preferred_lft forever
- 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
- link/ether 00:0c:29:87:e0:73 brd ff:ff:ff:ff:ff:ff
- inet 192.168.226.120/24 brd 192.168.226.255 scope global noprefixroute ens33
- valid_lft forever preferred_lft forever
- inet6 fe80::d39e:4dcb:77e4:2e1/64 scope link dadfailed tentative noprefixroute
- valid_lft forever preferred_lft forever
- inet6 fe80::6be7:95e9:3752:4825/64 scope link noprefixroute
- valid_lft forever preferred_lft forever
- [root@localhost ~]# getenforce
- Disabled
- [root@localhost ~]# systemctl status firewalld
- ● firewalld.service - firewalld - dynamic firewall daemon
- Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
- Active: inactive (dead)
- Docs: man:firewalld(1)
- [root@localhost ~]# cat /etc/os-release
- NAME="openEuler"
- VERSION="20.03 (LTS-SP1)"
- ID="openEuler"
- VERSION_ID="20.03"
- PRETTY_NAME="openEuler 20.03 (LTS-SP1)"
- ANSI_COLOR="0;31"
- [root@localhost ~]# hostnamectl
- Static hostname: localhost.localdomain
- Icon name: computer-vm
- Chassis: vm
- Machine ID: 6e651e4200034fa4816fbf148b66fa60
- Boot ID: 003f89b590064c168035b1247711b946
- Virtualization: vmware
- Operating System: openEuler 20.03 (LTS-SP1)
- Kernel: Linux 4.19.90-2405.5.0.0251.oe1.x86_64
- Architecture: x86-64
- 查看我之前传入的文件数据是否损坏
- [root@localhost ~]# ll
- 总用量 24
- -rw-------. 1 root root 1417 5月 12 19:34 anaconda-ks.cfg
- -rw-r--r--. 1 root root 12430 8月 11 23:23 tty.sh
- -rw-r--r--. 1 root root 150 8月 11 23:26 yinyue.mp3
- [root@localhost ~]# cat tty.sh
- #!/bin/bash
- # **********************************************************
- # * Filename : elk1.9.sh
- # * Author : Elk
- # * Email : zzdict@gmail.com / elk_deer@foxmail.com
- # * Create time : 2024-04-25 10:12
- # * Description : 不合理设置喊我,持续更新维护中......
- # **********************************************************
- start_time=$(date +%s)
- keep_going=true
- yum install -y beep &> /dev/null
- while $keep_going; do
- RED='\033[0;31m'
- GREEN='\033[0;32m'
- YELLOW='\033[1;33m'
- BLUE="\033[34m"
- CYAN='\033[0;36m'
- MAGENTA='\033[0;35m'
- BOLD='\033[1m'
- ......
- ......
- ......
- 经验证,数据完整并正常使用 我的脚本依旧运行使用
- [root@localhost ~]# sh tty.sh
- ***************** ELK *****************
- [1]. 防火墙DOWN
- [2]. 临时关闭SELinux
- [3]. 配置SELinux永久关闭
- [4]. 配置阿里源
- [5]. 配置本地源
- [6]. 一键安装常用工具包与系统分析工具
- [7]. 自定义静态IP
- [8]. MySQL-8.0
- [9]. MySQL-5.7
- [10]. 创建MySQL远程账户
- [11]. Fuck工具
- [12]. 设置时区并同步时间
- [13]. 设置系统最大打开文件数
- [14]. 系统内核优化
- [15]. 减少SWAP使用
- [q]. 退出
- *************** Automation ***************
- 请选择模块:
复制代码
清理操纵会执行清理环境操纵将删除/.osbak目次下的备份文件,并卸载x2openEuler-upgrade软件。
这个清理根据需要自行选择,这里我没啥用就点击清理测试一下
 
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |