Nextcloud Installation on CentOS 8
Nextcloud
Nextcloud Version: 18.0.4CentOS - 8.1.1911
Nextcloud Installation Commands on CentOS 8 |
Website: https://kesaribabu.blogspot.com |
*****Begin***** |
sudo su |
systemctl enable --now cockpit.socket |
vi /etc/hosts |
system-ip hostname.example.com hostname |
df -h |
free -h |
cd / |
mkdir nextcloud |
dnf install -y epel-release yum-utils unzip curl wget bash-completion policycoreutils-python-utils mlocate bzip2 |
dnf update -y |
dnf install -y httpd |
systemctl enable httpd.service |
systemctl start httpd.service |
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm |
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm |
dnf install yum-utils |
dnf module reset php |
dnf module install php:remi-7.4 |
dnf update |
dnf install -y php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-opcache php-json php-zip php-smbclient php-ldap |
dnf --enablerepo=PowerTools install libedit-devel |
dnf install -y php-pear gcc curl-devel php-devel zlib-devel pcre-devel make |
pecl channel-update pecl.php.net |
pecl install redis |
dnf config-manager --set-enabled PowerTools |
dnf install -y ImageMagick-devel |
pecl install imagick |
cp /etc/php.ini /etc/php.ini.bkp |
vi /etc/php.ini |
memory_limit = 768M |
extension=redis.so |
extension=imagick.so |
dnf install -y mariadb mariadb-server |
systemctl enable mariadb.service |
systemctl start mariadb.service |
mysql_secure_installation |
mysql -u root -p |
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; |
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; |
GRANT ALL PRIVILEGES on nextcloud.* to 'user'@'localhost'; |
FLUSH privileges; |
quit; |
cp /etc/my.cnf.d/mariadb-server.cnf /etc/my.cnf.d/mariadb-server.cnf.bkp |
vi /etc/my.cnf.d/mariadb-server.cnf |
[server] |
skip-name-resolve |
innodb_buffer_pool_size = 1G |
innodb_io_capacity = 4000 |
innodb_buffer_pool_instances = 1 |
innodb_flush_log_at_trx_commit = 2 |
innodb_log_buffer_size = 32M |
innodb_max_dirty_pages_pct = 90 |
query_cache_type = 1 |
query_cache_limit = 2M |
query_cache_min_res_unit = 2k |
query_cache_size = 64M |
tmp_table_size= 64M |
max_heap_table_size= 64M |
slow-query-log = 1 |
slow-query-log-file = /var/log/mysql/slow.log |
long_query_time = 1 |
[mysqld] |
innodb_large_prefix=on |
innodb_file_format=barracuda |
innodb_file_per_table=1 |
transaction_isolation = READ-COMMITTED |
binlog_format = ROW |
character-set-server = utf8mb4 |
collation-server = utf8mb4_general_ci |
dnf install -y redis |
systemctl enable redis.service |
systemctl start redis.service |
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.4.tar.bz2 |
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.4.tar.bz2.md5 |
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.4.tar.bz2.sha256 |
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.4.tar.bz2.asc |
wget https://nextcloud.com/nextcloud.asc |
md5sum -c nextcloud-18.0.4.tar.bz2.md5 < nextcloud-18.0.4.tar.bz2 |
sha256sum -c nextcloud-18.0.4.tar.bz2.sha256 < nextcloud-18.0.4.tar.bz2 |
gpg --import nextcloud.asc |
gpg --verify nextcloud-18.0.4.tar.bz2.asc nextcloud-18.0.4.tar.bz2 |
tar -xvjf nextcloud-18.0.4.tar.bz2 |
cp -R nextcloud/ /var/www/html/ |
mkdir /nextcloud/data |
chown -R apache:apache /nextcloud/data |
firewall-cmd --zone=public --add-service=https --permanent |
firewall-cmd --zone=public --add-service=http --permanent |
firewall-cmd --reload |
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(/.*)?' |
semanage fcontext -a -t httpd_sys_rw_content_t '/nextcloud/data(/.*)?' |
mkdir /var/www/html/nextcloud/data |
chown -R apache:apache /var/www/html/nextcloud |
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?' |
restorecon -R '/var/www/html/nextcloud/' |
restorecon -R '/nextcloud/' |
setsebool -P httpd_can_network_connect on |
sudo yum install mod_ssl |
sudo mkdir /etc/ssl/private |
sudo chmod 700 /etc/ssl/private |
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt |
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 |
cat /etc/ssl/certs/dhparam.pem | sudo tee -a /etc/ssl/certs/apache-selfsigned.crt |
vi /etc/httpd/conf.d/non-ssl.conf |
<VirtualHost *:80> |
ServerName server-ip or hostname |
Redirect "/" "https://server-ip or hostname/nextcloud" |
</VirtualHost> |
vi /etc/httpd/conf.d/ssl.conf |
#Find the section <VirtualHost _default_:443> and add lines till ../dav and remaining at respective location |
<VirtualHost _default_:443> |
DocumentRoot "/var/www/html" |
ServerName server-ip or hostname:443 |
<IfModule mod_headers.c> |
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" |
</IfModule> |
Redirect 301 /.well-known/carddav https://server-ip or hostname/nextcloud/remote.php/dav |
Redirect 301 /.well-known/caldav https://server-ip or hostname/nextcloud/remote.php/dav |
#SSLCertificateFile /etc/pki/tls/certs/localhost.crt |
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt |
#SSLCertificateKeyFile /etc/pki/tls/private/localhost.key |
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key |
systemctl restart httpd |
systemctl restart mariadb |
visit https://system-ip or hostname/nextcloud |
create user |
change data directory /var/www/html/nextcloud/data to /nextcloud/data |
provide mariadb details |
cd /var/www/html/nextcloud/ |
sudo -u apache php occ db:add-missing-indices |
sudo -u apache php occ db:convert-filecache-bigint |
cp /var/www/html/nextcloud/config/config.php /var/www/html/nextcloud/config/config.php.bkp |
vi /var/www/html/nextcloud/config/config.php |
'htaccess.RewriteBase' => '/nextcloud', |
'memcache.local' => '\\OC\\Memcache\\APCu', |
vi /etc/httpd/conf/httpd.conf |
#Find the section <directory /var/www/html> and change AllowOverride None to AllowOverride All |
<Directory "/var/www/html"> |
AllowOverride All |
cd /var/www/html/nextcloud/ |
sudo -u apache php occ maintenance:update:htaccess |
systemctl restart httpd |
*****End***** |
ref url: https://docs.nextcloud.com/server/18/admin_manual/installation/example_centos.html |
ref url: https://docs.nextcloud.com/server/18/admin_manual/configuration_database/linux_database_configuration.html |
Website: https://kesaribabu.blogspot.com |
Thank you :) |
Download PDF
Download XLSX
Comments
Post a Comment