Want to host your own DropBox clone? I’m going to go over our setup for hosting our own dropbox clone using owncloud and a server instance from our in house eucalyptus cloud.

Since we are hosting this inside ubuntu 12.04 server edition, most of the installation will be done in the command line.  Open up the command line from within your server and begin.

1. Install the package dependencies required inside ubuntu 12.04 server. (update to latest ubuntu packages first, might have to reboot after upgrade, open a new terminal after upgrade to check for restart messages)
sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoclean && sudo apt-get autoremove && sudo apt-get dist-upgrade
sudo apt-get install apache2 php5 php5-gd php-xml-parser php5-intl php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl

2. Download owncloud (version 5 at this time of writing).
wget http://download.owncloud.org/community/owncloud-5.0.0.tar.bz2

3.  Unzip owncloud and move it to the hosted apache document root. Modify permissions to be accessible for your webserver (we are using apache)
tar xvf owncloud-5.0.0.tar.bz2
sudo mv owncloud /var/www/
sudo chown www-data:www-data -R /var/www/owncloud

4.  Modify apache configuration to host owncloud. (We want to host with SSL for security  so we will be using a self signing certificate).

apache config

sudo a2enmod rewrite headers ssl
openssl genrsa -des3 -out ip-172-31-254-122.key 1024
openssl req -new -newkey rsa:2048 -nodes -keyout ip-172-31-254-122.key -out ip-172-31-254-122.csr
openssl x509 -req -days 365 -in ip-172-31-254-122.csr -signkey ip-172-31-254-122.key -out ip-172-31-254-122.crt
sudo mv ip-172-31-254-122.crt /etc/ssl/certs/
sudo mv ip-172-31-254-122.key /etc/ssl/private

5.   Install mysql or percona database.  (We are using Percona-5.5 and we will be building percona from source.) [or use my script to install]
Because we are installing this on a eucalyptus cloud instance, which has limited hdd storage in root, I will move the mysql data directory to /var/lib/mysql/data

sudo apt-get install build-essential cmake bison ncurses-base ncurses-bin ncurses-runtime ncurses-dev
wget http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/Percona-Server-5.5.30-rel30.1.tar.gz
cmake -L && cmake . && make && sudo make install
sudo addgroup –system mysql
sudo adduser –system mysql –no-create-home -ingroup mysql
cd /usr/local/mysql
sudo chown -R mysql:mysql .
sudo mkdir /var/lib/mysql
sudo ./scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql
sudo chown -R root .
sudo chown -R mysql data
sudo mkdir /var/run/mysqld
sudo chown -R mysql:mysql /var/run/mysqld
cd /usr/local/mysql/support-files
sudo cp my-large.cnf /etc/my.cnf
sudo chown mysql:mysql /etc/my.cnf

# modify mysql configuration file  using your own custom settings as they vary depending on hardware and preference.
sudo vim /etc/my.cnf 

sudo mkdir /var/log/mysql
sudo chown mysql /var/log/mysql
cd /usr/local/mysql/support-files
sudo cp mysql.server /etc/init.d/mysql
sudo chmod +x /etc/init.d/mysql
sudo update-rc.d mysql defaults
sudo /etc/init.d/mysql restart
mysqladmin -u root password
sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
cd /usr/local/mysql
sudo ./bin/mysql_secure_installation

6.  open web browser and navigate to your owncloud domain or ip and follow the on screen configuration directions.

owncloud install