How to Install ownCloud 9 on CentOS 7
ownCloud
is an open source free cloud software that allows you to have a
personal synching service. It is similar to the Dropbox cloud storage
but operates on your own server. The software has been in the market for
years now and has proven its robustness by all means. It is quick,
secure, and easy to setup.
In this tutorial we are going to install the latest up to date
version of ownCloud 9 (v9.0.2) on CentOS 7. ownCloud requires the below
softwares to run:
- MySQL/MariaDB
- PHP 5.4 +
- Apache 2.4 with mod_php
We will choose to install MariaDB, PHP 5.5, and Apache 2.4
Install MariaDB 5.5
Run the below command to install MariaDB server and client. We will use MariaDB to connect ownCloud to its own MySQL database.
|
yum install mariadb-server mariadb
|
Start the MariaDB server:
Allow MariaDB to start during machine boot:
Configure MySQL to ensure it is secured and running:
|
mysql_secure_installation
|
Install Apache 2.4
ownCloud 9 has a friendly web interface. This requires the installation of Apache. Run the below command to install Apache 2.4.6
Start the Apache service
Add Apache to allow it to start during boot time:
To test if Apache is running fine, browse to your machine IP : http://your-machine-ip/
You should see the below Apache test page:
Install PHP 5.5
If you run “yum install php” you will be installing PHP v5.4.
Unfortunately, this version is not supported anymore and has reached
EOL. That is why ownCloud recommends installing PHP 5.5+ .
The first step is to install the SCL repository:
|
yum install centos-release-scl
|
Then install PHP 5.5 and these modules:
|
yum install php55 php55-php php55-php-gd php55-php-mbstring php55-php-mysqlnd
|
Copy the PHP 5.5 Apache modules into place:
|
cp /opt/rh/httpd24/root/etc/httpd/conf.d/php55-php.conf /etc/httpd/conf.d/
cp /opt/rh/httpd24/root/etc/httpd/conf.modules.d/10-php55-php.conf /etc/httpd/conf.modules.d/
cp /opt/rh/httpd24/root/etc/httpd/modules/libphp55-php5.so /etc/httpd/modules/
|
Then restart Apache:
Verify with phpinfo that your Apache server is using PHP 5.5 and
loading the correct modules. Create a new file in the httpd directory:
|
vi /var/www/html/info.php
|
Now we call that file in a browser http://your-machine-ip/info.php . You should get the below:
Install ownCloud 9 (v9.0.2)
Run the following shell commands as root to trust the repository:
|
rpm --import https://download.owncloud.org/download/repositories/9.0/CentOS_7/repodata/repomd.xml.key
|
Run the following shell commands as root to add the repository and install from there.
|
wget http://download.owncloud.org/download/repositories/9.0/CentOS_7/ce:9.0.repo -O /etc/yum.repos.d/ce:9.0.repo
|
Clean expired cache to ensure you install the latest ownCloud files:
Install ownCloud:
|
yum install owncloud-files
|
Once done with the installation, browse to http://your-server-ip/owncloud . You should get the following page.
However, there are some directory permissions that need to be fixed
in order to continue with the ownCloud 9 installation wizard.
Fix Permissons
ownCloud has created a bash script that fixes those permissions.
Create a new file in the /tmp directory and give it execute permissions.
Add the below to the file we created:
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
28
29
30
31
32
33
34
35
36
37
|
#!/bin/bash
ocpath='/var/www/html/owncloud'
htuser='apache'
htgroup='apache'
rootuser='root'
printf "Creating possible missing Directories\n"
mkdir -p $ocpath/data
mkdir -p $ocpath/assets
mkdir -p $ocpath/updater
printf "chmod Files and Directories\n"
find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
printf "chown Directories\n"
chown -R ${rootuser}:${htgroup} ${ocpath}/
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
chown -R ${htuser}:${htgroup} ${ocpath}/assets/
chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${ocpath}/data/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
chmod +x ${ocpath}/occ
printf "chmod/chown .htaccess\n"
if [ -f ${ocpath}/.htaccess ]
then
chmod 0644 ${ocpath}/.htaccess
chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
fi
if [ -f ${ocpath}/data/.htaccess ]
then
chmod 0644 ${ocpath}/data/.htaccess
chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
fi
|
Allow execute permissions to the file we created:
|
chmod 755 /tmp/dirperm.sh
|
Output:
|
/tmp/dirperm.sh
Creating possible missing Directories
chmod Files and Directories
chown Directories
chmod/chown .htaccess
|
When you have SELinux enabled on your Linux distribution, you may run
into permissions problems after a new ownCloud installation, and see
permission denied errors in your ownCloud logs. Run these commands as
root:
|
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
restorecon '/var/www/html/owncloud/data'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
restorecon '/var/www/html/owncloud/config'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
restorecon '/var/www/html/owncloud/apps'
|
Refresh the page and you should get the following:
Configure Database
To continue with the installation wizard, we need to create a database for ownCloud and a user to access this database:
|
mysql -u root -p
Enter password:
|
Run the below commands in order:
|
CREATE DATABASE owncloudDB;
GRANT ALL ON owncloudDB.* to 'ownclouduser'@'localhost' IDENTIFIED BY 'ENTER_PASSWORD';
FLUSH PRIVILEGES;
quit
|
Choose MySQL as database and fill in the information needed and create a new admin user:
After finalizing the installation wizard, you will have a new ownCloud 9 installation ready to store data!
Congratulations! You’ve now have ownCloud 9 up and running. However,
you have to know that it is accessible by everyone online. So make sure
you follow up about hardening your ownCloud security by following this
tutorial:
https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/harden_server.html
If you need any help or have any questions, just comment below and I’ll be glad to assist you.
Tidak ada komentar:
Posting Komentar