Nâng cấp Debian 10 lên Debian 11
Mô tả
Trong bài viết này, chúng tôi sẽ mô tả quy trình nâng cấp HĐH từ Debian 10 lên Debian 11.
Nâng cấp
Trước khi nâng cấp hệ điều hành, chúng tôi đặc biệt khuyến nghị tạo bản sao lưu đầy đủ cho toàn bộ dữ liệu trên máy chủ. Điều này sẽ đóng vai trò như một phương án bảo hiểm trong trường hợp xảy ra sự cố, cho phép bạn khôi phục hệ thống khi khẩn cấp.
Tất cả lệnh trong quá trình nâng cấp HĐH đều được thực thi trong terminal của máy chủ dưới người dùng root.
Từ chối các đề xuất của hệ thống về việc thay thế tệp cấu hình (hành động mặc định).
Tên các tệp kho lưu trữ trong /etc/apt/sources.list.d của HĐH của bạn có thể khác với các tên được sử dụng trong hướng dẫn này.
- Hãy bảo đảm bạn có đúng các kho lưu trữ trong
/etc/apt/sources.list. Danh sách kho lưu trữ cho Debian 9 có thể được tìm thấy bên dưới.
Các kho lưu trữ Debian 10
deb http://archive.debian.org/debian/ buster main contrib non-free
deb-src http://archive.debian.org/debian/ buster main contrib non-free
deb http://archive.debian.org/debian/ buster-updates main contrib non-free
deb-src http://archive.debian.org/debian/ buster-updates main contrib non-free
deb http://archive.debian.org/debian-security buster/updates main contrib non-free
deb-src http://archive.debian.org/debian-security buster/updates main contrib non-free
- Cập nhật tất cả các gói hiện tại lên phiên bản mới nhất
apt update && apt dist-upgrade
- Thay thế danh sách kho lưu trữ trong
/etc/apt/sources.listbằng các kho của Debian 11. Danh sách kho lưu trữ cho Debian 11 có thể được tìm thấy bên dưới.
Các kho lưu trữ Debian 11
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
- Khắc phục các lỗi cập nhật proftpd có thể xảy ra
sed -e 's/^IdentLookups/#IdentLookups/' -i /etc/proftpd/proftpd.conf
- Cập nhật các gói. Chạy từng lệnh sau, mỗi lần một lệnh
apt update
apt upgrade
apt dist-upgrade
- Cập nhật các kho lưu trữ khác
sed -i 's|buster|bullseye|g' /etc/apt/sources.list.d/*.list
- Thêm khóa kho lưu trữ nginx
wget -q -O - http://nginx.org/keys/nginx_signing.key |apt-key add -
Kho lưu trữ Debian 11 không có các phiên bản cũ của máy chủ cơ sở dữ liệu. Để nâng cấp thêm, bạn cần chỉ định lần lượt các phiên bản 8.0 và 10.5 cho MySQL và MariaDB trong /etc/apt/sources.list.d/. Bạn có thể tìm phiên bản máy chủ cơ sở dữ liệu hiện tại bằng cách thực thi lệnh
mysql -V
Nếu đang sử dụng MySQL, hãy thay đổi phiên bản gói và thêm khóa kho lưu trữ:
sed -i 's/mysql-5.7/mysql-8.0/g' /etc/apt/sources.list.d/mysql.list
wget -q -O - http://repo.mysql.com/RPM-GPG-KEY-mysql |apt-key add -
Đối với MariaDB thấp hơn 10.5, hãy sử dụng:
sed -i 's/10.[0-4]/10.9/' /etc/apt/sources.list.d/mariadb.list
- Cập nhật các gói
apt update
apt dist-upgrade
- Cài đặt PHP 7.3 với các mô-đun cơ bản, PHP7.3-FPM và mô-đun Apache2
dpkg -l | awk '/php7.3/ {print $2}' | sed -e 's/7.3/7.4/' | xargs apt install -y
apt install -f php php-fpm libapache2-mod-php libapache2-mod-php7.4 php-common php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-xmlrpc php-imagick php-memcached
phpenmod calendar ctype curl dom exif fileinfo ftp gd gettext iconv json mbstring mysqli mysqlnd pdo pdo_mysql phar posix readline shmop simplexml sockets sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl opcache imagick memcached
- Thay thế cấu hình PHP-FPM
mv /opt/php74/etc/php-fpm.d/* /etc/php/7.4/fpm/pool.d/
rm /etc/php/7.3/fpm/pool.d/www.conf
mv /etc/php/7.3/fpm/pool.d/* /opt/php73/etc/php-fpm.d/
- Gỡ bỏ PHP 7.3
apt purge php7.3*
- Kích hoạt PHP 7.4
a2enmod php7.4
- Sửa phiên bản PHP trong cơ sở FASTPANEL
sqlite3 /usr/local/fastpanel2/app/db/fastpanel2.db "update site set php_version = 74 where mode = 'mpm_itk';"
- Cài đặt thành phần Dovecot cần thiết để nhận thư
apt install dovecot-lmtpd
- Cấu hình lại các dịch vụ
mogwai services configure -f
- Cấu hình bổ sung tùy thuộc vào máy chủ cơ sở dữ liệu đang sử dụng
Đối với MySQL 8 - thêm cài đặt tương thích
echo 'disable-log-bin
mysqlx = OFF
default-authentication-plugin = mysql_native_password
character-set-server = utf8
collation-server = utf8_unicode_ci
' >> /etc/mysql/my.cnf.fastpanel/99-fastpanel.cnf
Đối với MariaDB - chạy mysql_upgrade
mysql_upgrade
- Khởi động lại máy chủ
reboot
- Hãy bảo đảm rằng tất cả dịch vụ đều được khởi động sau khi khởi động lại
systemctl --failed
Hoàn tất nâng cấp.