We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open source self hosted file sharing server that allows you to access or sync your files from any device from your server, similar to Dropbox.

Foremost update your system packages by running the following command:

sudo yum update -y

Once that's completed we can go ahead and install a web server of choice and PHP 5.6 (5.4+ is needed). We recommend using apache since it's ready to go out of the box. We'll be using webtatic's public repo to install PHP 5.6.

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install httpd php56w php56w-mysql php56w-dom php56w-mbstring php56w-gd php56w-pdo php56w-gd php56w-json php56w-xml php56w-zip curl php56w-curl sqlite -y

Next install and start the MySQL server and run the secure installation script to set a root password. Follow the installation prompts until it's completed.

yum install mysql mysql-server -y
service mysqld start
mysql_secure_installation

Once MySQL is setup and running lets edit our apache configuration to allow full .htaccess use. Using a text editor of choice (we recommend nano) edit the /etc/httpd/conf/httpd.conf file and find the following section:

<Directory "/var/www/html">

Under this section, look for the line "AllowOverride None" and change it to "AllowOverride All" then save the file.

Once that's done, lets create a new MySQL database for the ownCloud installer to use. Connect to MySQL first:

mysql -u root -p

Enter your MySQL root password and press enter, then run the following commands to create a database named "oc_db" which we will use, and grant privileges for your root user (or user of your choice), replace the "your_root_password" with the password of your user:

CREATE DATABASE oc_db;
GRANT ALL PRIVILEGES ON oc_db.* TO 'root'@'localhost' IDENTIFIED BY 'your_root_password';
FLUSH PRIVILEGES;

Press CTRL + C to close MySQL.

Lets start the apache web server now.

service httpd start

Navigate to the public apache web directory.

cd /var/www/html

Now download ownCloud. As of writing this, 8.0.4 is the latest version. Make sure to visit their website to get the download link for the current latest version.

wget https://download.owncloud.org/community/owncloud-8.0.4.zip
unzip owncloud*
rm -rf owncloud-8.0.4.zip
cd owncloud
mv * /var/www/html

Give apache proper permissions to the ownCloud files.

chown -R apache.apache /var/www/html/

Now go to your server IP in your web browser, http://server_IP_address/ and the ownCloud installer should appear. Enter in a username and password to use and click "Finish Setup". You can choose to use MySQL or SQLite storage, we did install MySQL earlier, however we recommend sticking with the default SQLite unless you plan to store lots of files.

If you get an error that the .htaccess file is missing, you may need to download it again. Do this easily with this command (run it inside your ownCloud web directory):

wget http://pastebin.com/raw.php?i=dzRCRQn2 -O .htaccess

That's it!

** You may need to add a firewall rule to allow traffic to your web server. You may also need to set SELinux to permissive moe to avoid errors.

Was this answer helpful? 12 Users Found This Useful (699 Votes)