NextCloud on CentOS
1. install and start the apache server
1 |
yum install -y httpd |
1 |
systemctl enable httpd.service |
1 |
systemctl start httpd.service |
2. install php
1 |
yum install -y php php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-pecl-redis php-opcache php-imagick php-opcache php-intl php-process |
3.set the php memory limit
1 |
vi /etc/php.ini |
1 |
memory_limit = 512M |
4. enable php cache
1 |
vi /etc/php.d/10-opcache.ini |
1 2 3 4 5 6 7 8 |
zend_extension=opcache opcache.enable=1 opcache.enable_cli=1 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.memory_consumption=128 opcache.save_comments=1 opcache.revalidate_freq=1 |
5. install the database server
1 |
yum install -y mariadb mariadb-server |
1 |
systemctl enable mariadb.service |
1 |
systemctl start mariadb.service |
6.configure the mariadb server
1 |
vi /etc/my.cnf |
1 2 3 4 |
[mysqld] innodb_large_prefix=true innodb_file_format=barracuda innodb_file_per_table=1 |
7. create the database
1 |
CREATE DATABASE cloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; |
1 |
CREATE USER 'cloud' IDENTIFIED BY 'password'; |
1 |
GRANT USAGE ON *.* TO cloud@'localhost' IDENTIFIED BY 'password'; |
1 |
GRANT ALL privileges ON cloud.* TO cloud@localhost; |
8. install redis
1 |
yum install -y redis |
1 |
systemctl enable redis.service |
1 |
systemctl start redis.service |
9. download the nextcloud, check the checksum and install it
1 |
wget https://download.nextcloud.com/server/releases/nextcloud-17.0.0.zip |
1 |
unzip nextcloud*.zip |
1 |
cp -R nextcloud/ /var/www/html/ |
1 |
mkdir /var/www/html/nextcloud/data |
1 |
chown -R apache:apache /var/www/html/nextcloud |
1 |
systemctl restart httpd.service |
10. set the SELinux contexts
1 |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?' |
1 |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?' |
1 |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?' |
1 |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.htaccess' |
1 |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini' |
1 |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?' |
1 |
restorecon -R '/var/www/html/nextcloud/' |
1 |
setsebool -P httpd_can_network_connect on |
11. define the apache virtual host for service
1 |
vi /etc/httpd/conf.d/nextcloud.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<VirtualHost cloud.krai.be:80> ServerName cloud.krai.be ServerAdmin cloud@krai.be RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L] </VirtualHost> <IfModule mod_ssl.c> <VirtualHost cloud.krai.be:443> ServerName cloud.krai.be ServerAdmin cloud@krai.be DocumentRoot /var/www/html/nextcloud <IfModule mod_headers.c> Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" </IfModule> <directory /var/www/html/nextcloud> Require all granted AllowOverride All Options FollowSymLinks MultiViews SetEnv HOME /var/www/html/nextcloud SetEnv HTTP_HOME /var/www/html/nextcloud </directory> SSLEngine on SSLCertificateFile /etc/letsencrypt/live/cloud.krai.be/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/cloud.krai.be/privkey.pem </VirtualHost> </IfModule> |
12. install the certboot
1 |
yum install certbot python2-certbot-apache -y |
13. enable firewall
1 |
firewall-cmd --zone=public --add-service=http |
1 |
firewall-cmd --zone=public --add-service=http --permanent |
1 |
firewall-cmd --zone=public --add-service=https |
1 |
firewall-cmd --zone=public --add-service=https --permanent |
14. generate the certificate
1 |
certbot --apache -d cloud.krai.be |