Euler system installation and deployment of NextCloud and data migration

1. Euler system installation

insert image description here
insert image description here

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

2. OpenEuler installs graphical interface Ukui

Go to the installation interface: https://blog.csdn.net/xcjyxy2021/article/details/123342877

insert image description here

3. The npm package installed by yum is saved locally (required for personal tasks)

insert image description here

#主要是更改yum.conf配置文件,找找自己文件位置
[root@Ban etc]# vi /etc/yum.conf

insert image description here

[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

insert image description here

4. Deploy nextCloud

4.1 Build the LAMP environment foundation

配置环境参考https://www.php.cn/php-weizijiaocheng-407708.html

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

insert image description here
insert image description here

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

insert image description here

4.2 Download and install nextCloud

官方下载网址:https://nextcloud.com/install/

insert image description here

4.2.1 Create nextCloud database to store network disk file index and user information

insert image description here

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

insert image description here

Using yum 离线批量安装npmwill automatically resolve dependencies, but since the server is not connected to the Internet, there are yum安装会联网加载yum源two solutions here:.

1、设置本地yum源,加载
2、sudo rpm -ivh httpd/*  # 批量本地安装rpm包,这里解析依赖,准备好安装过程中需要的所有库文件和源文件。 
原则上,少什么联网下什么。

insert image description here

# 开启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 folder data复制保存。
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

insert image description here

#导出dbname数据库,导出文件为mydb.sql(注:不用登录数据库,直接命令行输入,然后输入数据库密码)
mysqldump dbname > nextcloud.sql -u root -p

#导入数据库表 (登录数据库后进行 注:没有;结尾)
source /root/桌面/mydb.sql            

insert image description here

#最好重启下httpd
 systemctl restart httpd.service

6.3 Final completion

insert image description here
insert image description here

7. Frequently asked questions

1. The configuration directory cannot be written

insert image description here
insert image description here

[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

insert image description here

2. Unknown issues

部署成功之后, after a period of time it opens as follows:

insert image description here

[root@localhost httpd]# tail /var/log/httpd/error_log 

insert image description here

final solution

After several uninstalls changing the httpd config file to no avail, 最终不是通过修改httpd解决,反而是重新删除nextCloud,拷贝重新赋予权限之后解决the reason is unknown.

insert image description here

3. Problems during nextCloud data migration

insert image description here

Guess you like

Origin blog.csdn.net/m0_45057216/article/details/128527267
Recommended