一.
vim /etc/selinux/config
配置如下:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# ? ? enforcing - SELinux security policy is enforced.
# ? ? permissive - SELinux prints warnings instead of enforcing.
# ? ? disabled - No SELinux policy is loaded.
# 如果SELinux处于启动状态,一般状态为enforing。致使很多服务端口默认是关闭的
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# ? ? targeted - Targeted processes are protected,
# ? ? minimum - Modification of targeted policy. Only selected processes are protected.
# ? ? mls - Multi Level Security protection.
SELINUXTYPE=targeted
二.
yum -y install httpd httpd-tools
日志如下:
Running transaction
? Installing : apr-1.4.8-7.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1/5
? Installing : apr-util-1.5.2-6.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2/5
? Installing : httpd-tools-2.4.6-97.el7.centos.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3/5
? Installing : mailcap-2.1.41-2.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?4/5
? Installing : httpd-2.4.6-97.el7.centos.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5/5
? Verifying ?: apr-1.4.8-7.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1/5
? Verifying ?: mailcap-2.1.41-2.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2/5
? Verifying ?: httpd-tools-2.4.6-97.el7.centos.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3/5
? Verifying ?: apr-util-1.5.2-6.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?4/5
? Verifying ?: httpd-2.4.6-97.el7.centos.5.x86_64 ?
Installed:
? httpd.x86_64 0:2.4.6-97.el7.centos.5 ? ? ? ? ? ? ? ? ? ? ? ? httpd-tools.x86_64 0:2.4.6-97.el7.centos.5
systemctl start httpd
httpd.service - The Apache HTTP Server
? ?Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
? ?Active: inactive (dead)
? ? ?Docs: man:httpd(8)
? ? ? ? ? ?man:apachectl(8)
? ? ? ? ?? 查询状态 出现如下错误
Failed to start htppd.service: Unit not found.
先试用如下命令查询
systemctl list-unit-files --type=service
如果有 httpd 服务 使用?systemctl daemon-reload ,在yum install 安装的时候没有安装完全使用完之后在启动依然会出现 Job for httpd.service failed. See "systemctl status httpd.service" and "journalctl -xe" for details. 查询httpd的状态
?httpd.service - The Apache HTTP Server
? ?Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
? ?Active: failed (Result: protocol) since Wed 2022-04-20 19:48:46 CST; 43s ago
? ? ?Docs: man:httpd(8)
? ? ? ? ? ?man:apachectl(8)
? Process: 5884 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS)
?Main PID: 5884 (code=exited, status=0/SUCCESS)
Apr 20 19:48:46 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]: Starting The Apache HTTP Server...
Apr 20 19:48:46 iZ2ze0t8eea7sr5m24u4x5Z httpd[5884]: AH00558: httpd: Could not reliably determine the server's fully quali...ssage
Apr 20 19:48:46 iZ2ze0t8eea7sr5m24u4x5Z httpd[5884]: httpd (pid 5830) already running
Apr 20 19:48:46 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]: Failed to start The Apache HTTP Server.
Apr 20 19:48:46 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]: Unit httpd.service entered failed state.
Apr 20 19:48:46 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
使用最笨的方法 用
ps -aux | grep httpd?
kill -9 杀httpd的进程
然后?
systemctl start httpd
在查询 httpd的状态
systemctl status httpd
日志如下:
httpd.service - The Apache HTTP Server
? ?Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
? ?Active: active (running) since Wed 2022-04-20 19:51:18 CST; 14s ago
? ? ?Docs: man:httpd(8)
? ? ? ? ? ?man:apachectl(8)
?Main PID: 5926 (httpd)
? ?Status: "Total requests: 0; Current requests/sec: 0; Current traffic: ? 0 B/sec"
? ? Tasks: 6
? ?Memory: 2.9M
? ?CGroup: /system.slice/httpd.service
? ? ? ? ? ?├─5926 /usr/sbin/httpd -DFOREGROUND
? ? ? ? ? ?├─5927 /usr/sbin/httpd -DFOREGROUND
? ? ? ? ? ?├─5928 /usr/sbin/httpd -DFOREGROUND
? ? ? ? ? ?├─5929 /usr/sbin/httpd -DFOREGROUND
? ? ? ? ? ?├─5930 /usr/sbin/httpd -DFOREGROUND
? ? ? ? ? ?└─5931 /usr/sbin/httpd -DFOREGROUND
Apr 20 19:51:18 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]: Starting The Apache HTTP Server...
Apr 20 19:51:18 iZ2ze0t8eea7sr5m24u4x5Z httpd[5926]: AH00558: httpd: Could not reliably determine the server's fully quali...ssage
Apr 20 19:51:18 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
开启系统启动项然后查询状态:
systemctl enable htppd
systemctl status httpd
第三步:安装配置 Mariadb 服务
yum install mariadb-server mariadb -y
安装日志如下:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
? Installing : perl-Data-Dumper-2.145-3.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1/10
? Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2/10
? Installing : 1:mariadb-5.5.68-1.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3/10
? Installing : perl-Net-Daemon-0.48-5.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4/10
? Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?5/10
? Installing : perl-IO-Compress-2.061-2.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6/10
? Installing : perl-PlRPC-0.2020-14.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 7/10
? Installing : perl-DBI-1.627-4.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 8/10
? Installing : perl-DBD-MySQL-4.023-6.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 9/10
? Installing : 1:mariadb-server-5.5.68-1.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 10/10
? Verifying ?: perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1/10
? Verifying ?: perl-Net-Daemon-0.48-5.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2/10
? Verifying ?: perl-Data-Dumper-2.145-3.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 3/10
? Verifying ?: 1:mariadb-server-5.5.68-1.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?4/10
? Verifying ?: perl-DBD-MySQL-4.023-6.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5/10
? Verifying ?: 1:mariadb-5.5.68-1.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6/10
? Verifying ?: 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 7/10
? Verifying ?: perl-DBI-1.627-4.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 8/10
? Verifying ?: perl-IO-Compress-2.061-2.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 9/10
? Verifying ?: perl-PlRPC-0.2020-14.el7.noarch ? ?
??
??
Installed:
? mariadb-server.x86_64 1:5.5.68-1.el7
Dependency Installed:
? mariadb.x86_64 1:5.5.68-1.el7 ? ? ? ? perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
? perl-DBD-MySQL.x86_64 0:4.023-6.el7 ? perl-DBI.x86_64 0:1.627-4.el7 ? ? ? ? ? ? ? ?perl-Data-Dumper.x86_64 0:2.145-3.el7
? perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 ? ? ? ? ?perl-PlRPC.noarch 0:0.2020-14.el7
安装10个,1个服务9个依赖,和上面对一下全部成功。
安装完成?Mariadb 服务之后加入系统启动项
systemctl start mariadb
systemctl enable mariadb
查询 Mariadb 运行状态
systemctl status mariadb
出现如下日志说明状态正常:Active: active (running)
Active: active 已激活状态
● mariadb.service - MariaDB database server
? ?Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
? ?Active: active (running) since Wed 2022-04-20 20:03:33 CST; 37s ago
?Main PID: 6089 (mysqld_safe)
? ?CGroup: /system.slice/mariadb.service
? ? ? ? ? ?├─6089 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
? ? ? ? ? ?└─6254 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=...
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: MySQL manual for more instructions.
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: Please report any problems at http://mariadb.org/jira
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: The latest information about MariaDB is available at h...g/.
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: You can find additional information about the MySQL part at:
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: http://dev.mysql.com
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: Consider joining MariaDB's strong and vibrant community:
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mariadb-prepare-db-dir[6005]: https://mariadb.org/get-involved/
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mysqld_safe[6089]: 220420 20:03:31 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Apr 20 20:03:31 iZ2ze0t8eea7sr5m24u4x5Z mysqld_safe[6089]: 220420 20:03:31 mysqld_safe Starting mysqld daemon with databas...mysql
Apr 20 20:03:33 iZ2ze0t8eea7sr5m24u4x5Z systemd[1]
MySQL安全配置向导:
mysql_secure_installation
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...
上面巴拉巴拉说一堆就看那个 NOTE 就可以,意思是 MariaDB使用msi安全向导,下面的配置步骤要仔细
(1)Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.
设置MySQL的用户名和密码,记住了,后面控制台登录要用,选择 Y
Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ?... Success! ? (2)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.
MariaDB安装有一个匿名用户,允许任何人使用,选N可以自己创建一个,y就是使用这个匿名用户,我的服务器块到期了我选择的Y,正常使用建议选择 N
Remove anonymous users? [Y/n] y ?... Success! ? (3)Normally, root should only be allowed to connect from 'localhost'. ?This ensures that someone cannot guess at the root password from the network.
是设置用户是否从localhost链接
Disallow root login remotely? [Y/n] y ?... Success! ? (4)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.
就是让你是否删除?MariaDB 的测试数据库,我选择的Y留着占内存,删了省心
Remove test database and access to it? [Y/n] y ?- Dropping test database... ?... Success! ?- Removing privileges on test database... ?... Success! ? (5)Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
让你重新加载配置,加载完之后就即可生效了,这个要选择 y Reload privilege tables now? [Y/n] y ?... Success! ? Cleaning up... #删除NextCloud 的test数据库
All done! ?If you've completed all of the above steps, your MariaDB installation should now be secure.
Thanks for using MariaDB!
第四步:安装 PHP 模块并配置 NextCloud
yum install php php-common php-mysqlnd php-curl php-zip php-bz2 php-intl php-mbstring php-gd php-pecl-zip php-xml php-json unzip wget -y
安装完成校对(这个校队可以忽略): Running transaction 安装数目 = Installed + Dependency Installed 总共已经安装数目之和就对了,有的Linux版会直接归为installed = Installed + Dependency Installed
第五步:创建?NextCloud 的 Databases?
mysql -uusername -ppassword
(1)创建 NextCloud 数据库
create database nextclouddb;
(2)创建一个新用户?
create user nextclouddevil@localhost identified by?? ?'password';
(3)在nextclouddb这个数据库上,给 nextclouddevil 这个用户所有权限
grant all on nextclouddb.* to nextclouddevil@localhost;
(4)刷新配置
flush privileges;
(5)退出
exit
第六步。下载并安装nextcloud,移动到 /var/www/html/ ?这个目录
cd /var/www/html/
(1)在浏览器上输入 https://nextcloud.com,找到nextcloud下载页面,下载 nextcloud 的 server 版本,鼠标对准下载按钮复制下载链接,然后通过wget httpurl下载到 /var/www/html这个目录下面 通过 unzip 解压
(2)在 /var/www/html/nextcloud 文件夹下面,创建一个 data 文件夹 ,
mkdir /var/www/html/nextcloud/data
(3)改变nextcloud这个文件夹的授权
chown -R apache:apache nextcloud
chmod -R 755 nextcloud
(4)改变收权之后 通过ls查看可以看到nextclou这个服务在apache下
drwxr-xr-x 15 apache apache ? ? 4096 Apr 20 20:36 nextcloud
(5)重启并查看httpd的状态
systemctl restart httpd
systemctl status httpd
(6)配置并重启防火墙
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
(7)浏览器 输入你的nextcloud地址,格式如下:
http://your-Ip-server/nextcloud
(8)安装完才写的教程, 它妈的没截图,将就看吧。
(a)创建用户名密码
storage & database
Data folder/数据目录不需要动
(b)配数据库选择 MySQL/Mariadb 然后输入你在终端创建的数据库 账户和密码
最后点击安装完成,到这就完成nextcloud的安装了。
第七部:安装完成之后可能会遇到上传大小限制 和 NextCloud 服务的私有化配置
(1)下面 是NextCloud的官方文档
big_file_upload_configuration
在?php.ini 文件中设置以下两个参数
php_value upload_max_filesize ?16 G? php_value ?post_max_size ?16 G
(2)配置?Nextcloud 服务器文件位置: Nextcloud 带有自己的nextcloud/.htaccess文件。因为php-fpm 无法读取 PHP 设置,.htaccess这些设置必须在 nextcloud/.user.ini文件中设置。
|