The ultimate guide: Owncloud 8 on CentOS 7.x – step by step. Will work 100%

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.

 

060215guide001

 

060215guide002 060215guide003 060215guide004 060215guide005

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.

060215guide006

Then you update the free space on the / there owncloud will be installed, and update settings.

060215guide007

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.

060215guide008

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
apachectl restart

How To Create an SSL Certificate on Apache for CentOS 7 (from this guide)

systemctl enable httpd.service
mkdir /etc/httpd/ssl
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 []:webmaster@example.com
vi /etc/httpd/conf.d/ssl.conf

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.

DocumentRoot "/var/www/example.com/public_html"

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):

 ServerName www.example.com:443

Find the SSLCertificateFile and SSLCertificateKeyFile lines and change them to the directory we made at /etc/httpd/ssl:

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.

apachectl restart

PHP 5.6.x

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.

php -v

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,

vi /etc/httpd/conf.d/owncloud.conf

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.

060215guide009

 

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.

060215guide010

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:

B9RbhIjCIAAf1Jm.png large

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

 

 

Upgrading PHP from 5.3 to 5.4.x or 5.5.x or 5.6.x on CentOS 6.x with Virtualmin

B9RbhIjCIAAf1Jm.png large

My little project upgrading PHP from 5.3 to 5.4 or 5.5/5.6 on CentOS 6.5 with Virtualmin 4 was not so simple as I wanted. A normal CentOS 6.x installation with Virtualmin installed have PHP 5.3.3 on it. It’s pretty old, so I wanted to upgrade to a newer version.

But it’s seems like CentOS 6 and Virtualmin don’t want you to upgrade, because after the upgrade, no of my PHP pages was loading, or they loaded, but they was completely blank.

But thanks to Prometeus/iwStack and Mr. Salvatore I got it all fixed. So here is my guide that I’m using on any server I want to upgrade PHP on.

1. Use the Remi repository to upgrade PHP and MySQL

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

yum –enablerepo=remi update -y

That will upgrade PHP from 5.3.3 to PHP 5.4.24 (15. January 2014).

If you want the newest PHP, version 5.5.x you must run the following command:

yum –enablerepo=remi,remi-php55 update -y

If you want to upgrade to PHP, version 5.6.x, you must run the following command:

yum –enablerepo=remi,remi-php56 update -y

Your sites will now only show blank PHP pages.

2. Edit php.conf and httpd.conf

Then you have to rename php.conf with the following command:

mv /etc/httpd/conf.d/php.conf  /etc/httpd/conf.d/php.conf.no

then you have to edit the file: /etc/httpd/conf/httpd.conf and find every line with php_ in it, and remove it. I have found out that there is at least one line per domain, so be sure to remove them all. I use Filemanager in Virtualmin, and edit the file, and the use the find and replace function, an replace all php_ with # .

3. Restart httpd

Then you have to restart httpd:

service httpd restart

If there is one or more remaining lines with php_ in httpd.conf you will get an error. Then edit httpd.conf once more and be sure to remove all lines with php_ and then run service httpd restart again. Repeat to it work.

4. Then fix MySQL

The last thing you have to do, to get everything working 100% again, is to run the following command:

mysql_upgrade -u root -p

Enter your root MySQL password, and thats it. If you get a error message, you are using the wrong root MySQL password. You can change it from Webmin, Servers, MySQL Database Server and Change Administration Password.

301214php1

Upgrading PHP from 5.3 to 5.4 or 5.5 (5.6) on CentOS 6.5 (6.6) with Virtualmin

B9R5WGICUAAJyo2.png large468x60_02

Please use my affiliate link if you need really fast cloud hosting from Vultr.com – 14 cities around the world. http://www.vultr.com/?ref=6802732

My little project upgrading PHP from 5.3 to 5.4 or 5.5 on CentOS 6.5(6) with Virtualmin 4 was not so simple as I wanted. A normal CentOS 6.x installation with Virtualmin installed have PHP 5.3.3 on it. It’s pretty old, so I wanted to upgrade to a newer version.

But it’s seems like CentOS 6 and Virtualmin don’t want you to upgrade, because after the upgrade, no of my PHP pages was loading, or they loaded, but they was completely blank.

But thanks to Prometeus and Mr. Salvatore I got it all fixed. So here is my guide that I’m using on any server I want to upgrade PHP on.

1. Use the Remi repository to upgrade PHP and MySQL

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

yum –enablerepo=remi update -y

That will upgrade PHP from 5.3.3 to PHP 5.4.24 (15. January 2014).

If you want the newest PHP, version 5.5.x you must run the following command:

yum –enablerepo=remi,remi-php55 update -y

If you want to upgrade to PHP, version 5.6.x, you must run the following command:

yum –enablerepo=remi,remi-php56 update -y

Your sites will now only show blank PHP pages.

2. Edit php.conf and httpd.conf

Then you have to rename php.conf with the following command:

mv /etc/httpd/conf.d/php.conf  /etc/httpd/conf.d/php.conf.no

then you have to edit the file: /etc/httpd/conf/httpd.conf and find every line with php_ in it, and remove it. I have found out that there is at least one line per domain, so be sure to remove them all. I use Filemanager in Virtualmin, and edit the file, and the use the find and replace function, an replace all php_ with # .

3. Restart httpd

Then you have to restart httpd:

service httpd restart

If there is one or more remaining lines with php_ in httpd.conf you will get an error. Then edit httpd.conf once more and be sure to remove all lines with php_ and then run service httpd restart again. Repeat to it work.

4. Then fix MySQL

The last thing you have to do, to get everything working 100% again, is to run the following command:

mysql_upgrade -u root -p

Enter your root MySQL password, and thats it. If you get a error message, you are using the wrong root MySQL password. You can change it from Webmin, Servers, MySQL Database Server and Change Administration Password.

160114php1

Please use my affiliate link if you need really fast cloud hosting from Vultr.com – 14 cities around the world. http://www.vultr.com/?ref=6802732

vultr_logo002