I have used several hours today, trying to get Owncloud to work on my CentOs 6.6 Virtual Machine. Gave it up, and tried CentOS 7. Got it to work, but not after just following one guide, but several. All guides missing some small parts, that make your life hard if you are trying to do what I’m wanted: Owncloud 8 running on a CentOS VPS/dedicated server.
Here is the ultimate guide, the guide that make you get it to work at first try. Not spending hours like me. I will link to all the guides I have got info from, so it’s mainly others that have made this guide possible, I have just collected all the pieces in one guide.
1. Installing CentOS 7 on your server/VPS/VM
The only thing you want to change here, is the disk setup if you have a large disk. CentOS 7, puts a small portion of you disk at /, then rest at /home. But if you follow the Owncloud guide, it automaticcly install it’s self on /, so you will only get the space there.
You can move the installation after it’s ready, but you have to change config files etc, so I do it simple, I take controll over the disk space under the installation of CentOS 7.
All field marked with red is places that you should click.
Here you reduce the partition to a low value, if you only are going to run Owncloud on this server, this number can be almost nothing.
Then you update the free space on the / there owncloud will be installed, and update settings.
This is my setup on a 500 GB disk. You can choose whatever you want, just remember that it’s / owncloud will be installed on, and it will be that space that is available in Owncloud.
Then you can setup and install CentOS 7 just like you want it. Thats complete part 1.
2. Make the server ready for Owncloud. (from this guide)
Run the following command as root user:
yum update -y
yum install httpd php php-mysql mariadb-server mariadb sqlite php-dom php-mbstring php-gd php-pdo wget mod_ssl-y
setsebool -P httpd_unified 1
Opening ports to Apache in firewall,
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
Start Apache and MariaDB,
systemctl start httpd.service systemctl start mariadb.service
Auto start the service at system start-up.
systemctl enable httpd.service systemctl enable mariadb.service
How To Create an SSL Certificate on Apache for CentOS 7 (from this guide)
systemctl enable httpd.service
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt
The full list of prompts will look something like this:
Country Name (2 letter code) [XX]:US State or Province Name (full name) :Example Locality Name (eg, city) [Default City]:Example Organization Name (eg, company) [Default Company Ltd]:Example Inc Organizational Unit Name (eg, section) :Example Dept Common Name (eg, your name or your server's hostname) :example.com Email Address :firstname.lastname@example.org
I’m always using vi when editing files in CentOS, but you can use whatever edit program you like.
Find the section that begins with
<VirtualHost _default_:443>. We need to make a few changes here to ensure that our SSL certificate is correctly applied to our site.
First, uncomment the
DocumentRoot line and edit the address in quotes to the location of your site’s document root. By default, this will be in
/var/www/html, and you don’t need to change this line if you have not changed the document root for your site. However, if you followed a guide like our Apache virtual hosts setup guide, your site’s document root may be different.
Next, uncomment the
ServerName line and replace
www.example.com with your domain name or server IP address (whichever one you put as the common name in your certificate):
SSLCertificateKeyFile lines and change them to the directory we made at
SSLCertificateFile /etc/httpd/ssl/apache.crt SSLCertificateKeyFile /etc/httpd/ssl/apache.key
When you are finished making these changes, you can save and close the file.
With Owncloud 8 the minimum requirement for PHP is PHP 5.4.x, some apps will need PHP 5.5.x. So why not just update PHP 5.6.x right away? This is an optional part, but then you are ready for the future:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php56w php56w-opcache -y
yum install yum-plugin-replace -y yum replace --enablerepo=webtatic-testing php-common --replace-with=php56w-common -y
You will get some error messages when you run the third command (yum install …) but just ignore them.
Per 15.February 2015 that will show PHP 5.6.5
That complete part 2.
3. Installing Owncloud 8 on your CentOS 7 server (from this guide)
Download and setup. We first install the repo. It is the official one.
cd /etc/yum.repos.d/ wget http://download.opensuse.org/repositories/isv:ownCloud:community/CentOS_CentOS-7/isv:ownCloud:community.repo yum install owncloud -y
Setting the owner to Apache:
chown -R apache:apache /var/www/html/owncloud/
Now we create the database and the user for MariaDB:
mysql -u root -p create database clouddb; grant all on clouddb.* to 'clouddbuser'@'localhost' identified by 'password';
It ask for password, but just hit enter, there is no password yet.
Remember the database name: clouddb, you will need it later on.
Next is configure the virtual host Apache file,
Add the following,
<Directory /var/www/html/owncloud> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
Restart Apache server,
systemctl restart httpd.service
Then you have to set a password on MySQL database, you will need this when you setup Owncloud later on. (from this guide)
mysqladmin -u root password NEWPASSWORD
There NEWPASSWORD is whatever password you like.
And then you are good to go to https://yourserver/owncloud to further configuration. Select MySQL/MariaDB instead of SQLite. Then use root at username for DB, then your new password you just made. Use localhost.
You can choose your own login name and password.
Then you have to click on MySQL/MariaDB
Then fill out the info from earlier in the guide. The user is root, the password is the password you set. The DB name is clouddb and localhost is correct. The you can finish the setup. (sorry for my Norwegian interface, it changes language to your language automatically if they have your language.
Finally, I can use all my disk space. And you are ready to go. Download on of the clients you get on your welcome screen, use your https://yourdomain-or-ip/owncloud and your username and password. And you are online.
That my ULTIMATE guide for setting up Owncloud 7 on a CentOS 7 server, with all the small parts from several guides, that will work every time.
It is not free using lots of my time to write guides and reviews, and host them. So if you like to give something back, please signup with one of my affiliates links if you need hosting or like to try them out. I recommend Vultr:
Vultr.com – 14 locations, really fast servers: http://www.vultr.com/?ref=6802732
DigitalOcean – The place for every developer: https://www.digitalocean.com/?refcode=6baa1cd0214b ( you get a free $10 credit if you use my link to sign up)
HostHatch – Want a 10Gbit server – you have found it: https://www.digitalocean.com/?refcode=6baa1cd0214b
Prometeus/Iwstack – Real cloud service: https://www.prometeus.net/billing/aff.php?aff=168