1. install and start the apache server
dnf install -y httpd
systemctl enable httpd.service
systemctl start httpd.service
2. install php
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf module reset php
dnf module enable php:remi-8.0
dnf module install php:remi-8.0
dnf install -y php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-opcache php-json php-zip php-redis php-imagick php-ldap php-memcached
3. set the php memory limit
vi /etc/php.ini
memory_limit = 1024M
4. enable php cache
vi /etc/php.d/10-opcache.ini
zend_extension=opcache opcache.enable=1 opcache.enable_cli=1 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.memory_consumption=1024 opcache.save_comments=1 opcache.revalidate_freq=1
5. install the database server
yum install -y mariadb mariadb-server
systemctl enable mariadb.service
systemctl start mariadb.service
6. create the database
CREATE DATABASE cloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'cloud' IDENTIFIED BY 'password';
GRANT USAGE ON *.* TO cloud@'localhost' IDENTIFIED BY 'password';
GRANT ALL privileges ON cloud.* TO cloud@localhost;
7. install redis
yum install -y redis
systemctl enable redis.service
systemctl start redis.service
8. download the nextcloud, check the checksum and install it
wget https://download.nextcloud.com/server/releases/nextcloud-24.0.1.zip
unzip nextcloud*.zip
cp -R nextcloud/ /var/www/html/
mkdir /var/www/html/nextcloud/data
chown -R apache:apache /var/www/html/nextcloud
systemctl restart httpd.service
9. set the SELinux contexts
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
restorecon -R '/var/www/html/nextcloud/'
setsebool -P httpd_can_network_connect on
10. define the apache virtual host for service
vi /etc/httpd/conf.d/nextcloud.conf
<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>
11. install the certboot
yum install certbot python2-certbot-apache -y
12. enable firewall
firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=https
firewall-cmd --zone=public --add-service=https --permanent
13. generate the certificate
certbot --apache -d cloud.krai.be