Home Wordpress Setup Local WordPress Development Environment In Linux

Setup Local WordPress Development Environment In Linux

By sk
Published: Last Updated on 1,629 Views

This detailed tutorial explains what is LocalWP, benefits of using LocalWP, how to install LocalWP to deploy and setup local WordPress development environment in Linux and Unix-like operating systems.

1. Introduction

If you're WordPress developer, you will have a few options to deploy and setup Wordpress websites.

You could directly build and work on the live site. But it is NOT RECOMMENDED and dangerous. You can create a staging site and deploy, test the wordpress installations before pushing them into production.

The another recommenced way is setup a local Wordpress development environment to deploy wordpress sites on your local system. This is the safest way to do all sorts of wordpress testing.

From the local Wordpress development site, you can test various plugins and customize the site as the way you want it. If you're a beginner, you also use the local wordpress development environment for learning purposes as well.

There are many ways to create a local wordpress development environment. You can install LAMP or LEMP stacks and deploy Wordpress on top of it. But this will require some manual work from your side.

Also setting up multiple Wordpress sites on LAMP/LEMP stack is not so convenient and time-consuming task.

The easiest, quickest and probably the best way to setup development environment for Wordpress is by using a tool named LocalWP.

2. What is LocalWP?

LocalWP, or just Local, is an application to deploy and develop wordpress sites locally.

You don't need to manually install web server (Apache or Nginx), database server (E.g. MySQL), and PHP. Local takes care of everything!

Using Local, you can easily install Wordpress on your system and create as many as wordpress sites you want with a couple mouse clicks!

Local allows you to effortlessly setup single or multi-site Wordpress installation. If everything works as the way you expected, you can push your local site to live.

You can clone your site, and even backup your site files to cloud storages such as Google drive or Dropbox.

Local is created by Flywheel, a company that provides affordable managed wordpress hosting. Local supports Linux, macOS and Windows platforms. It is completely free to use!

3. LocalWP features

Local has everything you need to install Wordpress, develop wordpress sites, and troubleshoot sites on your local system.

Here is the list of benefits of using Local on your system:

  • One-click automatic wordpress installation.
  • Single and multi-site wordpress installation.
  • Support for both subdomain and subdirectory installations.
  • SSL support. Self-signed certificates are automatically created for new sites.
  • Local gives you the ability to SSH into your Local wordpress sites.
  • Includes WP-CLI, the command-line interface to manage wordpress sites from command line.
  • Push and pull Local wordpress sites to Flywheel or WP Engine.
  • Create live links to your wordpress sites, so your client or colleagues can access and test the sites from anywhere.
  • No need to create and manage multiple user. Local one-click admin feature allows you to access the WP admin page with just one click!
  • Hot-swap environments. You can instantly switch to different versions of Apache or Nginx, MySQL and PHP. You can even switch to different webserver, for example Apache to Nginx and Vice versa.
  • Backup site files to Google drive and Dropbox.
  • Create blueprint of a site to re-use it later.
  • Import and export site files, databases, configuration files, log files, and Local settings.
  • Test outgoing email with MailHog
  • Enhance your local site with tools like Image Optimizer, Link Checker and Instant Reload.
  • Cross-platform support.
  • Completely FREE to use!

4. Install LocalWP in Linux

As stated already, Local can be installed in Linux, macOS and Microsoft Windows operating systems.

Go to LocalWP website and click the Download button. A new pop-up window will open. Choose your operating system type and fill up the other details such as your name and Email id and click Get it now button.

Download LocalWP
Download LocalWP

Go to the download location and install it using your distribution's package manager. I downloaded the .rpm file, so I installed LocalWP using rpm command like below:

$ sudo rpm -Uvh local-6.0.0-linux.rpm

If you downloaded the .deb file, you can install it using using dpkg command:

$ sudo dpkg -i local-6.0.0-linux.deb
$ sudo apt install -f

Alternatively, you can do:

$ sudo apt install ./local-6.0.0-linux.deb

This will install all the necessary dependencies in one go. Thanks Motlke for this tip.

5. Setup local WordPress development environment in Linux using LocalWP

Launch Local from Menu or Dash. It will be usually found under "Programming" section in your application menu.

Accept Local license agreement
Accept Local license agreement

You will be prompted to create a new account in LocalWP. It is required to backup files to cloud and create live links, so create account if you don't have one already.

Create free Local account
Create free Local account

You will be redirected to LocalWP website. Follow the on-screen steps to create a new account.

Create new account in LocalWP website
Create new account in LocalWP website

Once the account is created, close the browser window and go back to the Local application dashboard window.

This is how your Local dashboard looks like:

Local dashboard
Local dashboard

There are many options to choose from. You can create a new Wordpress site, or connect to managed hosting services or change your settings and preferences. First, let us start from creating a new Wordpress site.

5.1. Create new wordpress in Local

Click the "CREATE A NEW SITE" button or click the plus (+) sign on the bottom left corner to create a new wordpress site in Local.

Enter the Wordpress site's name. A new domain URL for your Wordpress will be automatically generated. You can view it under the Advanced options section. By default, all Local sites will have an .local extension. You can change it if you want to.

You can also view the path of your site in Local site path section. By default, it will be saved in a directory named "Local Sites" in your $HOME directory. If you're okay with the default options, click Continue.

Create new wordpress site in Local
Create new wordpress site in Local

Next choose your environment. Here, you will be given two options, namely Preferred and Custom.

Choose Local environment for Wordpress site
Choose Local environment for Wordpress site

You can choose the Preferred option to use a set of recommended tools for your Local site. Local will automatically choose Nginx, PHP and latest MySQL version if you select Preferred option.

Alternatively, you can choose the Custom option to select the tools of your choice.

Choose custom Local environment for Wordpress site
Choose custom Local environment for Wordpress site

Once you made the selection, click Continue.

Next enter the administrative user name for your Wordpress site, password and the Email. Under Advanced options, you can choose if you want this installation to be a multisite.

Enter Wordpress admin username and password
Enter Wordpress admin username and password

After a few minutes, you will see the newly installed Wordpress site is listed in the Local dashboard, along with all its information.

Setup local WordPress development environment using LocalWP
Setup local WordPress development environment using LocalWP

Congratulations! You just installed Wordpress using Local in your Linux machine!

You can click the "OPEN SITE" button to view how your new Wordpress looks like!

New Wordpress site
New Wordpress site

It is time to work on the newly created wordpress site!

5.2. Access Wordpress site admin dashboard

From the Local dashboard, Click the Admin button:

Access Wordpress Admin page
Access Wordpress Admin page

Your wordpress site's login page will open in a new browser window. Enter the admin user and its password to login to WP admin page.

Log in to Wordpress
Log in to Wordpress

Start working on your new Wordpress site!

Wp Admin page
Wp Admin page

5.3. Configure Wordpress settings

In the Local dashboard, you will see the following tabs to configure and tweak various settings.

  1. Overview
  2. Database
  3. Utilities
  4. Tools

The Overview section displays the details of your Wordpress site. Here, you can find your wordpress site URL, web server (Apache or Nginx), PHP and MySQL versions, Wordpress version and the option to enable self-signed SSL certificate.

In the Database section, you will see the option to connect to Adminer management tool, database name, database user name and password.

From the Utilities section, you can configure configure and test outbound E-mail.

The last section is Tools the section where you will find the Live link URL and the username and password to access the live link.

One of the best feature of Local is Live Link. It will convert your locally-built wordpress site into a shareable test environment, so any authorized person will able to access the Local site from anywhere. This comes in handy when you want to show your local site to your clients.

To create a live link for your local site, click Enable button in the bottom of the Local dashboard.

Enable Live Link in LocalWP
Enable Live Link in LocalWP

Once you enabled the Live Link option, a publicly accessible URL will be generated. Also the shareable link is protected with an username and password.

You can view view the details of the link and credentials by clicking on the Live Link button or under the Tools section.

Live Link details for Local Wordpress site
Live Link details for Local Wordpress site

Just send this URL along with the username and password to your clients. They can access your Local site from anywhere using the shared URL.

Please note that the live links are viewable only when your computer is turned on and connected to Internet.

5.5. Access Adminer dashboard

Adminier is a web-based database management tool. LocalWP includes it to make the database management easier.

To launch Adminer, click "OPEN ADMINER" button under the Database section from your Local dashboard.

Open Adminer
Open Adminer

The Adminer dashboard will open in a new browser window.

Adminer dashboard
Adminer dashboard

Here, you can view, configure and manage databases.

By default, Local will create database named "local". You can check all table content of the database and play around with running SQL queries from Adminer.

6. Troubleshooting

When you create a new Wordpress site, you will probably face the following error in Fedora.

Error: Command failed: /opt/Local/resources/extraResources/lightning-services/php-7.3.5+10/bin/linux/bin/php /opt/Local/resources/extraResources/bin/wp-cli/wp-cli.phar --path=/home/sk/Local Sites/ostechnix-testing-site/app/public --require=/opt/Local/resources/extraResources/bin/wp-cli/local-wpcli-error-reporting.php core config --skip-check --dbname=local --dbuser=root --dbpass=root --skip-salts
/opt/Local/resources/extraResources/lightning-services/php-7.3.5+10/bin/linux/bin/php-original: error while loading shared libraries: libnettle.so.6: cannot open shared object file: No such file or directory
Localwp error while loading shared libraries
Localwp error while loading shared libraries

If you encounter with error while loading shared libraries: libnettle.so.6 while creating new sites, you need to download the exact missing library and move it to your /usr/lib64/ directory.

In my case, the missing library is libnettle.so.6, so I fixed it as described in this link.

Close the Local application and run the following commands one by one:

$ cd ~/Downloads
$ sudo dnf install wget
$ wget https://kojipkgs.fedoraproject.org//packages/nettle/3.4.1rc1/3.fc31/x86_64/nettle-3.4.1rc1-3.fc31.x86_64.rpm
$ rpm2cpio nettle-3.4.1rc1-3.fc31.x86_64.rpm | cpio -idmv
$ sudo cp usr/lib64/libhogweed.so.4 /usr/lib64/
$ sudo cp usr/lib64/libnettle.so.6 /usr/lib64/

Now open Local and try to create new site. It should work now.

7. Conclusion

In this guide, we discussed what is LocalWP, and how to install wordpress using LocalWP in Linux. Setting up Local wordpress development environment gives you a safer and stress-free development experience. Using Local, you can deploy, build and test single or multiple Wordpress sites faster in your local system.

Further reading:

Featured image by Dok Sev from Pixabay.

You May Also Like

1 comment

Motlke July 27, 2021 - 7:47 pm

> If you downloaded the .deb file, you can install it using using dpkg command:

$ sudo dpkg -i -Uvh local-6.0.0-linux.deb

$ sudo apt install -f

Instead, you can do $ sudo apt install ./local-6.0.0-linux.deb which will install all the necessary dependencies in one go. 🙂

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More