Knowledge base
How to move a website to Oktawave cloud?
Posted by Pomoc Oktawave on 10.04.2013 11:37

Do you have problems with your hosting? Website sometimes works, sometimes doesn't work, and sometimes you get an e-mail from the administrator that he turned off your script, because your WordPress or Joomla are consuming too many system resources? These are real problems, anyone who knows the reality of Polish hosting knows that there is a difference between hosting providers declarations and reality. So we'll show you how to end this chapter in the life of your website and painlessly move it to cloud.

We assume that you are using the services of one of the popular Polish hoster (domain also), and your site works (and sometimes does not work) on the popular WordPress engine. Domain can stay with your current provider, but the rest - the files and the database you want to have in Oktawave.

You created free account at Oktawave - what to do next?
 

1. Preparation of the OCI instance

Think about OCI instance as of your current, existing hosting account, only much more powerful, without any restrictions, dictated by a company in which you held the page. To start the instance, after logging in to your User Control Panel at Oktawave, in the Services menu, select OCI: Oktawave Cloud Instances.

 


On the next screen, click Add OCI Instance. This takes you to the instance setup screen. The next step is to select the type of operating system. Here you should choose Linux (the most popular system for web hosting) and then its variety. We offer a very well-liked in Poland and very reliable Debian 6.

 



After selecting Debian you need to click the Select button.


 

In the last step You have to fill some informations, for example a name (any) and size (5 GB should be enough to start). Click Run OCI.

 



Step one is behind you! Your OCI instance is ready for operation.

 

2. Web Server Configuration

In such OCI instances you wont be able to run your web site. You will need to prepare the right environment for it. To do this, you need to log in to OCI and using the Linux command, install the necessary packages.

You can log in using the so-called SSH client, using the data sent to your mailbox. But there is a simpler way. In the Oktawave admin panel, you can run remote console, which will give you direct access to the server. Save your password in a convenient place (you can view it by clicking the Access data link), and then click Remote Console and select the duration of activity - for example, three hours. When you click Create, and then click the link to open the web client, your browser will open a new tab to access the server.

 



What you see now is called Linux shell - the primary interface through which you can give commands to your server. To log in, enter:

login: root
Password: Your password, that you received by an e-mail.

Now update the server software by typing commands in the console:

apt-get update
apt-get upgrade - show-upgraded
 
Packages necessary to run the web server will be downloaded by typing:

apt-get install apache2 php5 libapache2 body-mod-php5

Press Enter to install additional packages.

In order for rewriting links (mod_rewrite) work properly on a server and also selecting of the index file, type the following command:

a2enmod rewrite
nano / etc/apache2/sites-available/default

In the editor, add directive to the section <Directory /var/www/> :
 
DirectoryIndex index.php

and save the file by pressing Ctrl + O.

Then restart the web server:

/etc/init.d/apache2 restart

Your website will be located by default in /var/www. Let's see how it works, by preparing a test page for PHP interpreter (necessary for the operation of WordPress):

nano /var/www/test.php

In this way, you will run the text editor, in which you type:

<? php phpinfo ();?>

Ctrl + O to save your first page. Delete a redundant index.html file:

rm /var/www/index.html

To see if your web server is working properly, in your browser enter the IP address of OCI instance (you can check the IP Address tab in the instance configuration panel, it was also received in the mail), slash and test.php (eg. http://176.119. 33.50/test.php). This is the result of what you should see:

 



Bravo, Apache server with PHP support is already running!


3. Configuring the Database

Now prepare the MySQL database, used by WordPress:

apt-get install mysql-server mysql-client php5-mysql

This will install the database and display a window where you enter the password for the base root user. Save this password in a safe place.

Then secure the base by typing following command:

mysql_secure_installation

and to answer further questions press [Y].

With ready-made database, you can install a program to manage her popular phpmyadmin:

apt-get install phpmyadmin

During installation you will be prompted for the type of web server (select Apache2), the database administrator password (type the password that you specified when configuring the database for root) and password for phpmyadmin which will be used to register in database server (press Enter).

You can use phpmyadmin in web browser by typing its IP address and the phpmyadmin string after slash (eg. http://176.119.33.50/phpmyadmin/). You should see the login panel of the tool - log into it by typing root as the login and password that you have selected for the database.


 

 
4. Setting up FTP server

The next step is to install an FTP server through which you can upload files on your server:

apt-get install vsftpd

and configure it so that you can log in from the outside, with a standard FTP client (like FileZilla). To do this, open the configuration file:

nano /etc/vsftpd.conf

You should change the following parameters (if in front is a # symbol, remove it):

anonymous_enable = NO
local_enable = YES
write_enable = YES
local_umask = 002
chroot_local_user = YES

Restart the FTP with following command:

/etc/init.d/vsftpd restart
 
Logging in using the root account is not a good idea, you should prepare special user - webmaster, with access to the directory where you will find the Web site:

echo "/bin/false" >> /etc/shells
useradd-d /var/www-g www-data-s /bin/false webmaster

and set the login password for the new user:

passwd webmaster

and the appropriate write permissions to the directory with the web site:

chmod-R g+w /var/www
 
Now you can go ahead and log in via FTP to your OCI instance.

 
5. Prepare copies of web pages

What you do in this step may be slightly different from the following description, if your current hosting provider uses a different software. No matter what tools you use, these are two things - moving files and copy the database. We assume that the current hosting provider is offering cPanel management panel with a file manager and a phpmyadmin tool.

In file manager, select the directory with your web page (eg. public_html/www).





Select web page files and folders and choose from the context menu Compress option (as a compress type choose gziped tar archive). Download the resulting file (eg. mysite.tar.gz) to disk, by selecting from the context menu Download option.

Then go back to cPanel and start the phpmyadmin tool. In the left column, select the database that is being used by your site. After opening the database, select the Export tab.


 


On the next screen, select the method of export: Fast, format: SQL and click the Execute button.

As a result, you get to download a file with the extension. SQL. Save it in a safe place.

 

6. Uploading copy of web page on the OCI instance

Start the FTP server and log in to your OCI instance with the username and password specified in step two of the server configuration. Copy the .TAR.GZ file you've downloaded from the file manager to /var/www folder. After receiving the message that the file is copied correctly, go back to the remote console at your Oktawave instance and issue the command:

tar-zxvf mysiteWWW.tar.gz

The site has been unpacked - but when you enter the IP address of your OCI instance, you will see the message "Error Establishing a database connection". Time for preparation of a database.

Open phpmyadmin installed on an OCI instance (eg. http://176.119.33.50/phpmyadmin/).

Create a new database

 




and click Create.

Then click on the left column of the newly-established database name and select the Import tab from the top navigation. Upload by pressing the Choose button on the previously saved site database dump file (with the .SQL extension). Leave the other options unchanged, click the Execute button.

The entire database has been moved.

It is now time to prepare a user with permission to use it. Click the Permissions tab, and then click Add New User.

On the next screen, enter a user name, host (localhost) and password. Then, in the Global Permissions, click Select All, and then click Execute.

 




The final step is to set up WordPress so as to benefit from the new base.

Back to the remote console and type

nano /var/www/wp-config.php

Look for the line in the configuration file that defines the connection parameters to the database and enter the appropriate data there, for example:

define ('DB_NAME', 'mojastronawww');
define ('DB_USER', 'Webpage');
define ('DB_PASSWORD', 'Ba4rz0trud3hasl0');
define ('DB_HOST', 'localhost');

That's it - you have moved entirely a website.

But surely you would like to use not only the IP address but also by using the domain that you have purchased. This will involve changes to the domain configuration.



7. Changing the domain configuration

Virtually every domain registrar uses its own configuration panel through which you can manage your registered domain. The panels can be very different from each other, but their functionality comes down to the same thing: allow you to edit so-called domain records. See how you can do it in a panel of one of the most popular Polish registrars.

After logging on to the panel, go to the My Domains section.

 



From the Available Actions drop-down menu, select the DNS Configuration. At the newly opened screen, find the row with the so-called "A record" for a domain:

 



Click Edit and in the next panel, change the IP address to the IP address of your OCI instance.

 



Finish by clicking Save button.

That's it: now you have to wait for an update of DNS configuration. The change should take up to 24 hours. After that typing the domain for your website will be opened straight from the Oktawave cloud.

Do you have questions? Do not hesitate to write to us at support@oktawave.com. We will assist you in the migration process.

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.