Cookbook > Setting up your personal Linux & OwnCloud server

Note: would you like to install your personal open source cloud infrastructure, maintain it, manage your data by yourself and possibly develop artifacts upon it, like we needed to do in the frame of this project? If the answer is yes, then here comes below the step by step recipe on how to do it. The proposed software for Cloud-like operations, ownCloud, has been chosen among different ones. We explained our (interdisciplinary) choice in this post, commented here. It is an open source system with a wide community of developers (but no designers yet).

We plan to publish later some additional Processing libraries — in connection with this open source software — that will follow one of our research project’s objectives to help gain access to (cloud based) tools.

Would you then also like to “hide” your server in a traditional 19″ Cabinet (in your everyday physical or networked vicinity)? Here is a post that details this operation and what to possibly “learn” from it –”lessons” that will become useful when it will come to possible cabinet alternatives–.

 

A) Linux Server

1 server:

  • CPU 64bits
  • 8 to 16 Gb of memory
  • 1 to 4Tb of disk (can be duplicated in order to setup a RAID mechanism and obtaining a built-in physical redundancy backup)
  • 1 x screen
  • 1 x USB keyboard
  • 1 x USB mouse
  • (optional) – dual electric inputs for backup purpose
  • (optional) – dual network interfaces for backup purpose or network speed optimization

1 operating system (prefer Linux if you want to stick to open source projects). CentOS is a good Linux distribution to consider, very well documented. You can usually download the installer from the Internet and burn it on a CD, DVD or even on a USB Key as an installation support.

-

How To:

Plug all the wires in your brand new (or old) server, insert the Linux installer’s CD or DVD and switch the computer on.

After showing some hardware check information, it should boot up on the CD/DVD. CentOS installer will appear, few basic questions will be asked (language, time zone, network etc…). CentOS installer is well documented and propose a set of default choices for each decision. CentOS will propose a set of predefined configurations, starting from a very basic installation to a fully loaded server (which includes the setup of a Web server, domain name server etc…).

CentOS will propose a set of predefined configurations. Choose the configuration that fits your needs. Keep in mind that you can always add and remove features afterwards, at anytime, so the basic desktop is always a good choice. Prefer to add features step by step, when you are sure that you do need it. Installing useless services can easily drives you to security issue by making your server proposing unsecured features. You should always be able to know the exact list of services proposed by your server.

Once the configuration you have chosen is completely installed, the server will reboot and a bunch of seconds later you will front the CentOS GUI, being able to log in by using the credentials you have mentioned during the installation process. Welcome to your first server.

 

B) ownCloud

Prior to be able to install ownCloud on your server, you will need to setup several services usually resumed in the acronym LAMP. Each letter is associated with one piece of software. We will go through some explanations as it is always better to understand as precisely as possible what we are doing while setting up a LAMP bundle.

1 x Linux:

L stands for Linux, and we already got one by installing the CentOS operating system. This prerequisite was already explained and addressed in the previous part of this post.

1 x Apache:

A stands for Apache. Apache is one of the most used web server. Like Linux, it is open and free to use. A web server is basically what will distribute web content to you. As soon as you want to access a web link/URL beginning with http or https, your request is intercepted and treated by a web server. You ask something, the web server make it available on your preferred Internet device just a few seconds later. While ensuring a kind of very basic task, a web server can be tricky to configure. There is many parameters and some of them are linked to security issue. As a web server, somehow, distributes to the whole world the content hosted on your server, it is very important to be sure to give access only to specific parts of your server and not to the entire content of your hard drive (unless you would like to fully open it).

1 x MySQL:

M stands for MySQL. MySQL is a database server. It is like a web server but dedicated to databases. Databases are usually organized as a set of tables, each table composed of a set of data fields. A data field can be a text, a number, a date, a unique reference number etc… a database being a collection of records. For example, this web site is a database filled with a collection of posts. One post being basically defined by its author, date and time, categories and its content. MySQL is quite straight forward to install, with a few steps to secure it.

1 x PHP:

P stands for PHP. PHP is a programming language, also called server-side scripting language. A basic web page can be composed of static HTML tags that need to be delivered to a web browser and interpreted by it so to visually display these tags as a “page”. This delivered static web page can then be stored on the web server with the exact same content. It means that delivering this content can be summarized as the simple act of sending the html page from the web server to the user’s web browser.
Yet nowadays, the content of a web page can be made out of dynamic or live data extracted from a database, or it can be the result of some computation processes performed server-side (performed on the web server). That’s where a server-side scripting language like PHP is needed. Within a dynamic web page that still needs to be delivered, one can then have PHP instructions that will probe a database to extract some data, add these data to the distributed web page and send the final formatted web page. The execution of the PHP instructions is initiated by the Apache web server and PHP instructions may probe the MySQL database when needed.

Thus you now have an overall picture of the role of each LAMP modules. ownCloud (as a web site) will use Apache to show user’s content, distribute/share files, user’s data, user’s files and file’s meta information being stored in the ownCloud’s MySQL database, using PHP to filter distributed information, checking login credentials, etc…

-

How To:

Install Apache. You will have to open a terminal. If you choose the Minimal Desktop, you can go to Applications/System Tools/Terminal. That’s basically a command shell where you can invoke Linux commands. For example typing ‘ls’+ENTER will show current directory content, ‘pwd’+ENTER will show the current directory etc… (all Linux commands here). Let’s install Apache web server components by typing ‘sudo yum install httpd’+ENTER. It will display packages to be downloaded and installed, just answer ‘yes’ when prompted and Apache will be downloaded and installed. Once finished, type ‘sudo service httpd start’+ENTER, this will start Apache web server, Then open Firefox on your server and try to access http://127.0.0.1 and you should see the default Apache welcome page. In order to make Apache web server starting automatically after having (re)booted your server, type ‘sudo chkconfig httpd on’+ENTER.

Install MySQL. Still within a terminal window, type ‘sudo yum install mysql-server’+ENTER. As previously with Apache, needed MySQL components will be listed, just answer ‘yes’ when prompted to start downloading and installing MySQL. Once finished, type ‘sudo service mysqld start’+ENTER in order to initiate the MySQL server. You need then to secure MySQL by typing ‘sudo mysql_secure_installation’+ENTER. When prompted for the current root password, leave it blank and press ENTER. You will be asked to define the new root password, so take carefully note of the one you will choose. It will be your key access to your MySQL server. Then answer systematically ‘y’ to the 4 or 5 following questions, and you will be done with your MySQL server. In order to make MySQL server starting automatically after having (re)booted your server, type ‘sudo chkconfig mysqld on’+ENTER.

Install PHP. Still within a terminal window, type ‘sudo yum install php php-mysql’+ENTER. As previously with MySQL, needed PHP components will be listed, just answer ‘yes’ when prompted to start downloading and installing PHP. You are done with PHP. As PHP is just a program and not a server there is no need to make it start at reboot etc… Keep in mind that PHP is made of several modules that can be installed or removed. By typing ‘yum search php-’+ENTER you will see already installed modules. When specific modules are needed you can always install them via the command ‘sudo yum install PHPModuleName’+ENTER.

You are done with LAMP. The path to your web sites should be /var/www/html. In order to test PHP, create a php file from a terminal window again by typing ‘sudo nano /var/www/html/info.php’+ENTER. It will open a text editor, type ‘<?php phpinfo(); ?>’ and save the file. Thus, from a local web browser you should be able to access http://127.0.0.1/info.php. It will display a overall set of PHP information. Apache and PHP are operational.

InstallownCloud. Download ownCloud archive and extract it to your /var/www/html directory. Once you’ll have a directory like /var/www/html/owncloud, you will be able to follow the owncloud’s installation wizard via the web address http://127.0.0.1/owncloud. You can refer to the online documentation for setting steps. When the database choice is prompted, choose of course the MySQL option. Then, at some point, if you want your ownCloud publicly available, you will have to subscribe for a domain name (like mydomainname.org) and then configure accordingly your Apache web server in order to make it respond to http://www.mydomainname.org. You can then choose to make this web address point directly to your ownCloud server, or keep this web address for another web site and make ownCloud available via an address like http://www.mydomainname.org/owncloud/. But these choices depend on what you want to achieve.

 

Congratulations, you are now ready to play with your own personal cloud service!

 

As already stated, more Cook Books should come in the near future under http://www.iiclouds.org/category/cook_books/ Their purposes will be to help you work with this infrastructure and handle your data, so as to set up your own design projects that will tap into this infrastructure and transform it. Don’t forget also that an API already exists to help you develop your applications for ownCloud.

 

0 Comments