• About Tanya
  • Privacy Policy
  • Contact
  • Setting up a WordPress on the local server

    For setting up a WordPress on the system’s local server, we will be using the LAMP server stack. To install and set-up a LAMP server stack, you shall refer here.

    Downloading WordPress

    Download the latest version of WordPress with the .tar.gz extension. Make a directory and extract its file here.

    Using Command line

    To fetch the latest version, use:

    wget http://wordpress.org/latest.tar.gz

    This will download the compressed file in your working directory. Extract it in a new directory named wordpress in your working directory, by:

    tar xzvf latest.tar.gz

    Installing and setting up a WordPress

    The official guide to set-up the WordPress using FTP is here. Since we are using the LAMP on the local server, we have already installed the requirements.

    SetUp MySQL database

    We will first restart our MySQL database and access the root user. Each command will take a few seconds to process, so wait for it to complete.

    $ mysqld restart
    $ mysqld -u root -p
    Enter password:

    Create a new database

    You can see the current databases by the following command in the MySQL prompt.

    mysql> SHOW DATABASES;

    Now, to create a new database named startwordpress; write:

    CREATE DATABASE startwordpress;

    OR use the phpMyAdmin by accessing it from http://localhost/phpmyadmin
    Log in to the user by entering the username and password. Then, an interface would open. Go to Database > Create Database. Now, enter the name startwordpress

    Configure WordPress

    Open the wp-config-sample.php file from the WordPress directory.

    Fill in the information used to access the MySQL database

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'startwordpress');
    /** MySQL database username */
    define('DB_USER', 'root');
    /** MySQL database password */
    define('DB_PASSWORD', 'password');

    Grab secure values

    Type the following on the command line, to get the secure values as a response from the WordPress key generator. It will be different each time a request is made.

    curl -s https://api.wordpress.org/secret-key/1.1/salt/

    Copy the response values received in the following given code as a replacemnet to ‘put your unique phrase here’ corresponding to the respective fields.

    . . .
    #define('AUTH_KEY',         'put your unique phrase here');
    #define('SECURE_AUTH_KEY',  'put your unique phrase here');
    #define('LOGGED_IN_KEY',    'put your unique phrase here');
    #define('NONCE_KEY',        'put your unique phrase here');
    #define('AUTH_SALT',        'put your unique phrase here');
    #define('SECURE_AUTH_SALT', 'put your unique phrase here');
    #define('LOGGED_IN_SALT',   'put your unique phrase here');
    #define('NONCE_SALT',       'put your unique phrase here');
    . . .

    Change WordPress prefix

    There are a lot of debates on whether the prefix affects the security of the WordPress. Though, it is a safe step. The prefix can be anything among numbers and letters, but the underscore at the end is compulsory.

    $table_prefix  = 'xlss2_';

    Save the file as wp-config.php

    Transfer files to /var/www/

    Now, send the files from the current directory to the localhost server to continue with the configuration and setup the CMS.

    sudo rsync -avP ~/wordpress/ /var/www/html/

    Access the WordPress

    Open http://localhost/wp-admin on the browser to continue with the remaining configuration by entering details like Site Title, Username, password, email, etc.

    Now, log in to the browser and start using the WordPress CMS on the local server.

    Leave a Reply

    %d bloggers like this: