Euler system deploys NextCloud and solves common deployment problems and data disk migration
- 1. Euler system installation
- 2. OpenEuler installs graphical interface Ukui
- 3. The npm package installed by yum is saved locally (required for personal tasks)
- 4. Deploy nextCloud
- 5. Deploy NextCloud in offline npm package mode (personal needs, after building a LAMP environment in a normal networked state, copy NextCloud and install it)
- 6. NextCloud network disk data migration
- 7. Frequently asked questions
1. Euler system installation
insert image description here
2. OpenEuler installs graphical interface Ukui
Go to the installation interface: https://blog.csdn.net/xcjyxy2021/article/details/123342877
3. The npm package installed by yum is saved locally (required for personal tasks)
#主要是更改yum.conf配置文件,找找自己文件位置
[root@Ban etc]# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
keepcache=1
gpgcheck=1
logfile=/var/log/yum.log
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
Note:
yum缓存的不一定全部缓存了npm包
, check what are the installed packages, whether they are all cached, and if there is no cache, which one is not cached,卸载单独安装缓存该npm包
.
查看命令
rpm -qa|grep php
4. Deploy nextCloud
4.1 Build the LAMP environment foundation
4.1.1 Open httpd, firewall port number
firewall-cmd --list-all-zones #查看所有的zone信息
firewall-cmd --get-default-zone #查看默认zone是哪一个
firewall-cmd --zone=internal --change-zone=p3p1 #临时修改接口p3p1所属的zone为internal
firewall-cmd --add-service=http #暂时开放http
firewall-cmd --permanent --add-service=http #永久开放http
firewall-cmd --zone=public --add-port=80/tcp --permanent #在public中永久开放80端口
firewall-cmd --permanent --zone=public --remove-service=ssh #从public zone中移除服务
firewall-cmd --reload #重新加载配置
原文链接:https://blog.csdn.net/cctcc/article/details/68062142
以下为使用到的命令:
[root@localhost yum]# systemctl start httpd.service
[root@localhost yum]# systemctl enable httpd.service
[root@localhost yum]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@localhost yum]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@localhost yum]# firewall-cmd --reload
success
[root@localhost yum]# systemctl status httpd.service
4.1.2 Start MariaDB service
开启MariaDB服务,并设置系统启动时服务自动启动:
systemctl start mariadb.service
systemctl enable mariadb.service
设置MySQL root帐户的密码:
mysql_secure_installation
4.1.3 Install and test php
4.2 Download and install nextCloud
4.2.1 Create nextCloud database to store network disk file index and user information
show databases;
use mysql;
MariaDB [mysql]> select user,host,plugin from mysql.user;
+-------------+-----------+-----------------------+
| User | Host | plugin |
+-------------+-----------+-----------------------+
| mariadb.sys | localhost | mysql_native_password |
| root | localhost | mysql_native_password |
| mysql | localhost | mysql_native_password |
+-------------+-----------+-----------------------+
3 rows in set (0.002 sec)
# root | localhost
# 说明该root用户只支持本地访问。Host字段更改为'%',允许远程访问。
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [mysql]> FLUSH PRIVILEGES;
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root123' WITH GRANT OPTION;
Query OK, 0 rows affected (0.003 sec)
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.002 sec)
MariaDB [mysql]> select user,host,plugin from mysql.user;
+-------------+-----------+-----------------------+
| User | Host | plugin |
+-------------+-----------+-----------------------+
| mariadb.sys | localhost | mysql_native_password |
| root | localhost | mysql_native_password |
| mysql | localhost | mysql_native_password |
| root | % | mysql_native_password |
+-------------+-----------+-----------------------+
4 rows in set (0.001 sec)
# 创建nextcloud存储的数据库
create database nextcloud;
4.2.2 Copy NextCloud and create a data directory, grant permission to the directory
#以下是我的步骤,html文件夹可删除,自己建,赋予权限很重要!
[root@localhost html]# cp /root/桌面/nextCloud/* /var/www/html/
[root@localhost html]# mkdir /var/www/html/data
[root@localhost nextCloud]# chown apache:apache -R /var/www/html/
[root@localhost nextCloud]# chown apache:apache -R /var/www/html/data/
# setenforce 0很重要
# 表示 设置SELinux 成为permissive模式 临时关闭selinux防火墙
# 永久关闭:输入命令vi /etc/selinux/config,将SELINUX=enforcing改为SELINUX=disabled,然后保存退出
[root@localhost nextCloud]# setenforce 0
[root@localhost nextCloud]# systemctl start httpd.service
5. Deploy NextCloud in offline npm package mode (personal needs, after building a LAMP environment in a normal networked state, copy NextCloud and install it)
[root@localhost yum]# yum localinstall -y ./httpd/* //批量安装离线npm包
Check whether the cached npm is in the file. There is a tree command, which is more convenient.
需要安装tree
#安装命令
yum -y install tree
Using yum
离线批量安装npm
will automatically resolve dependencies, but since the server is not connected to the Internet, there areyum安装会联网加载yum源
two solutions here:.
1、设置本地yum源,加载
2、sudo rpm -ivh httpd/* # 批量本地安装rpm包,这里解析依赖,准备好安装过程中需要的所有库文件和源文件。
原则上,少什么联网下什么。
# 开启Apache服务,并设置系统启动时服务自动启动:
[root@localhost yum]# systemctl start httpd.service
[root@localhost yum]# systemctl enable httpd.service
#为了能够从外部访问Web服务器,必须在防火墙中打开HTTP(80)和HTTPS(443)端口。
#CentOS上的默认防火墙是firewalld,可以使用firewalld-cmd命令进行配置。
[root@localhost yum]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@localhost yum]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@localhost yum]# firewall-cmd --reload
success
[root@localhost yum]# systemctl status httpd.service
# 开启MariaDB服务,并设置系统启动时服务自动启动:
systemctl start mariadb.service
systemctl enable mariadb.service
# 设置MySQL root帐户的密码:
mysql_secure_installation
# 安装好php后,要重启Apache服务
systemctl restart httpd.service
[root@localhost html]# cp /root/桌面/nextCloud/* /var/www/html/
[root@localhost html]# mkdir /var/www/html/data
[root@localhost nextCloud]# chown apache:apache -R /var/www/html/
[root@localhost nextCloud]# chown apache:apache -R /var/www/html/data/
# setenforce 0很重要
# 表示 设置SELinux 成为permissive模式 临时关闭selinux防火墙
# 永久关闭:
输入命令vi /etc/selinux/config,将SELINUX=enforcing改为SELINUX=disabled,然后保存退出
[root@localhost nextCloud]# setenforce 0
[root@localhost nextCloud]# systemctl start httpd.service
6. NextCloud network disk data migration
主要思路:
1. Move the Mangdb database of the original network disk数据库表导出
, the file cache folderdata复制保存。
2. On another virtual machine or server部署好nextCloud
, create a new administrator account to log in, and then you can use the exit button to原先存储的账户登录
view it in the database To the original data, you can delete the administrator account just created.
3.运行正常
On nextCloud on another virtual machine导入原迁移的数据库表与合并两个data文件夹
6.1 Export all database tables
数据库详细操作
Transfer link: https://www.php.cn/mysql-tutorials-418491.html
#导出dbname数据库,导出文件为mydb.sql(注:不用登录数据库,直接命令行输入,然后输入数据库密码)
mysqldump dbname > nextcloud.sql -u root -p
#导入数据库表 (登录数据库后进行 注:没有;结尾)
source /root/桌面/mydb.sql
#最好重启下httpd
systemctl restart httpd.service
6.3 Final completion
7. Frequently asked questions
1. The configuration directory cannot be written
[root@localhost nextCloud]# systemctl start httpd.service
[root@localhost nextCloud]# chown apache:apache -R /var/www/html/
[root@localhost nextCloud]# chown apache:apache -R /var/www/html/data/
[root@localhost nextCloud]# setenforce 0
2. Unknown issues
部署成功之后
, after a period of time it opens as follows:
[root@localhost httpd]# tail /var/log/httpd/error_log
final solution
After several uninstalls changing the httpd config file to no avail,
最终不是通过修改httpd解决,反而是重新删除nextCloud,拷贝重新赋予权限之后解决
the reason is unknown.