Upload and Deploy Drupal from Ubuntu XAMPP to Hosting Server using SSH

This is an important tutorial on how to upload and deploy your Drupal website from Ubuntu XAMPP to a remote hosting server. In this way, you can deploy your website to the Internet and make it viewable by everyone.

This beginner tutorial will focus more on Linux users; the installation instructions assume you are using Linux OS, PHP and MySQL in Apache web server. SSH (Secure Shell) also must be enabled in your hosting account. For details, you need to contact your hosting support.

Updating Modules and Running Cron Manually

This step assumes you have completed your Drupal website development in Ubuntu XAMPP. But before you upload it to your hosting server, you need to make sure that you are using the latest modules, and that you have run the cron manually.

Installing modules is best done through a development server, so that it won’t interrupt your visitors in a production environment.

To do this:

  1. Log in to your Drupal website as administrator.
  2. Click “Administer” – “Reports” – “Status Reports.”
  3. If all items under “Status Report” have green check marks, then you can skip this section and move on to next section.
  4. If not all items have green check marks, or some items are NOT up to date, click “run cron manually” first.
  5. After seeing the message “Cron ran successfully,” click “Available updates.”
  6. Make sure all of those items are “Up to date” before uploading the website to your server.

To upgrade an outdated module, go through the following steps.

  1. For modules that are not updated under “Available updates,” click the “Download” link. This will download the package to your Ubuntu download directory.
  2. Go to your Drupal module directory (/opt/lampp/htdocs/drupal/modules) in XAMPP and delete the old module folder.
  3. Right click on the module tar.gz package and click “Extract here.” Copy the extracted folder to the Drupal module directory in XAMPP. This is now the new/updated module.
  4. Make sure you are still logged in as administrator to your Drupal website. In the browser address bar, run update.php e.g. entering the URL below and pressing enter: http://localhost/drupal/update.php
  5. Follow the procedure stated in update.php. This will perform any necessary updating to your Drupal database because of updated modules. You need to ensure that you have no errors during this update before uploading your website.

You can browse your website after update.php and see if everything operates normally, as it did before. If you are using an outdated Drupal core, you should update it also, before uploading to the server. You can follow the tutorial here: http://drupal.org/upgrade/tutorial-introduction

The objective of this section is to make sure all of your modules and the Drupal core are up to date before uploading to the server.

Creating a domain or sub-domain in your hosting account

Since you need to upload your Drupal website to your hosting account, you need to assign a domain or sub-domain name to it. To do this, log in to your hosting account and add a domain name. For details on adding a domain name to your hosting account, you need to refer to your hosting support manual/tutorials.

It can take some time for the DNS propagation to complete. To test that your domain or sub-domain is ready for uploading, you need to do the following:

1. At the Linux terminal, log in to your SSH server:

codex-m@codex-m-desktop:~$ ssh yourusername@your_ssh_hostname.com

2. Enter your SSH password.

3. Most websites are placed in the www folder (or some using public_html), but that depends on how the hosting company configures your hosting account, so you need to look for it.

After logging in, try viewing all files and directories using the ls command:

-bash-2.08b$ ls
logs/ mail/ sys/ temporary/ tmp/ www/

4. Go into the www folder (using the CD command) and view the files again until you see your domain added in your hosting account:

-bash-2.08b$ cd www
-bash-2.08b$ ls
codexdrupal.php-developer.org/  dotnetdevelopment.net/
codexjoomla.php-developer.org/  php-developer.org/

Suppose that, in this example, a sub-domain is used for the Drupal installation in the remote server (you can also use the domain name, not a sub-domain). And the sub-domain is codexdrupal.php-developer.org. Go to this sub-domain:

-bash-2.08b$ cd codexdrupal.php-developer.org

You are now in the root directory of your future Drupal website. Delete all unnecessary files created by your hosting company:

-bash-2.08b$ rm *

5. In the bash prompt, type:

-bash-2.08b$ pico fullserverpath.php

In the editor type this script:


To save, press Control- O then press Enter key. To exit, press Control-X. View the full server path of your root directory in the browser by entering:


It will return, for example, something like this:


This means the full server path to the root directory is:


You can safely delete fullserverpath.php after this. If your SSH server does not have the PICO command, you can manually create the PHP script in your Ubuntu desktop with the code shown above. Then you can upload it to your Drupal website root directory using an SSH client and view the return path in the browser.

{mospagebreak title=Import Drupal Database from XAMPP to a Hosting Server}

To import a Drupal database from your XAMPP, go through the following steps.

Step 1. Create a MySQL database first in your remote server. This will be used for your Drupal website. You can go to your hosting control panel and create the database. For details, you need to refer to your hosting support for creating MySQL databases. Take note of the following MySQL login credentials created:

  • Username
  • Password
  • Database name
  • Hostname

Step 2. Using a Linux terminal, navigate to your Ubuntu XAMPP bin folder.

codex-m@codex-m-desktop:/$ cd /
codex-m@codex-m-desktop:/$ cd opt
codex-m@codex-m-desktop:/opt$ cd lampp
codex-m@codex-m-desktop:/opt/lampp$ cd bin

Step 3. Execute the MySQL dump command to copy the Drupal database from your XAMPP to your remote hosting MySQL database server (do not forget the “.” dot sign before the forward slash):


Note: The credentials: Drupal_database_username, Drupal_database_password, Drupal_database_hostname and Drupal_database_name_in_remote_server are the MySQL login credentials for your Drupal website in the remote server, which you created in the first step.

If you want to see a screen shot of the command prompt, go here: http://www.php-developer.org/screenshot/mysqldumptoremotehostingserver.jpg

Important: Do not close the terminal while the copying is going on; wait until it is completed.

Copy All Drupal Files in Your XAMPP to a Remote Server

Execute the SCP (secure copy command using Terminal/SSH) command that will copy all files (including folders and hidden files such as .htaccess) from your Drupal XAMPP localhost folder to your Drupal website hosting root directory.

codex-m@codex-m-desktop:~$ scp -r /opt/lampp/htdocs/drupal/. your_ssh_username@sshhostname.com:/home/www/codexdrupal.php-developer.org/

If you would like to see this in a command prompt screenshot: http://www.php-developer.org/screenshot/scpcommandrupaltoremote.jpg


  1. Do NOT forget to place a “.” dot sign after /drupal/ as this will make it possible to copy all hidden files, such as .htaccess.
  2. /home/www/codexdrupal.php-developer.org/ is the full server path to your root directory, as determined already in the previous sections (using fullserverpath.php script).
  3. You are required to enter your SSH password to proceed with the file uploading.
  4. The path to your local Drupal installation in XAMPP is: /opt/lampp/htdocs/drupal/ 

    The drupal folder name can change depending on what you are using.
  5. The uploading process can take a very long time. Do not close the terminal while the copying is going on; wait until it is done.

Configure Settings.php for database, base URL and .htaccess

To make your website work in the new hosting server, you need to make some adjustments in settings.php, base URL and the .htaccess. Follow the steps below:

1. Log in to your SSH server:

codex-m@codex-m-desktop:~$ ssh yourusername@your_ssh_hostname.com

2. Go to your Drupal website root directory:

-bash-2.08b$ cd www
-bash-2.08b$ cd codexdrupal.php-developer.org

3. Go to the sites directory and then to the default directory:

-bash-2.08b$ cd sites
-bash-2.08b$ cd default

4. Change the file permission of settings.php to 644.

-bash-2.08b$ chmod 644 settings.php

5. Edit settings.php
-bash-2.08b$ pico settings.php

6. Define the MySQL connection string of your remote Drupal website. Look for the $db_url variable and assign updated/correct values:

$db_url = ‘mysqli://mysqluser_name:mysql_password@coolest@codexserver.com/mysqldatabase_name’;

See the screen shot here:

In the screen shot the MySQL username is codex_m, the MySQL password is cutegirls999, the MySQL hostname is coolest@codexserver.com and the name of the MySQL database is drupaldatabase.

7. Define the base URL. Find the $base_url variable. It should be set to your Drupal home page URL (depending on whether you are using a sub-domain or main domain).

$base_url = ‘http://codexdrupal.php-developer.org’;  // NO trailing slash!

In the above base URL, the home page of the Drupal website in the remote hosting server is http://codexdrupal.php-developer.org/.

8. Save the changes in settings.php by pressing Control- O and then press the Enter key. Exit the editor by pressing Control-X.

You might notice that at this time, when you view your website in the browser, the home page is working, but other pages in the website return “Internal Server Error.”

This is because you need to make some adjustments in your .htaccess. To edit:

1. Go to your root directory using the SSH command line. You might need to type cd ..

-bash-2.08b$ cd ..

to go back to the root directory. You will know when you are in the root directory when you type:

-bash-2.08b$ pwd

Then it will return, for example:


2. Edit .htaccess:

-bash-2.08b$ pico .htaccess

Simply change:

# RewriteBase /


RewriteBase /

You will just remove the # before RewriteBase. Save the changes (Control-O – Enter key, then Press Control X to exit).

Finishing Touches for Drupal Deployment to Your Hosting Server

You can also do the following to complete your Drupal deployment:

1. Secure your Cron.php, and add the following lines in your .htaccess:

<Files "cron.php">
  Order allow,deny
  Allow from 123.456.789.123

Change the IP address 123.456.789.123 to use your own IP address. You can get your IP address here: http://www.whatismyip.com/

The above .htaccess lines will prevent public access to your cron.

2. Enable cron in your hosting account to automatically run cron.php. For some hosting accounts, you may have problems executing your cron, so you might change the file permission of cron.php to 755.

A sample configuration in Agilityhoster.com that will run the cron.php once a day can be found here: http://www.php-developer.org/screenshot/cronsetupdrupal.jpg. This method might not be the same for other hosting companies. In this case, you need to consult with your hosting support.

After completing all of these steps, try to browse to your website and log in as administrator. You can change your password if you like. Make sure everything is working properly, as it was on the XAMPP local host.

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye