Install wordpress locally

Install WordPress locally on Chromebook


Chromebook's linux development environment option creates a linux container. A sandbox for development.

Wouldn't it be neat and convenient to install Wordpress in a safe environment to try out latest features of Wordpress?

Starting the linux development environment container

Terminal app

Open the terminal app and click

Click setup

Click turn on

Clicking setup will take you to settings window where you can click "turn on" to have your Chromebook create a linux container.

Setup wizard

This opens the setup wizard for you to configure the size and account name for the development environment.

Select size and name

Since your container is just for testing things out in a baseline sandbox leaving the size to 10gb would be fine.

In a minute you have a container

Nice progress bar as your container is being provisioned.

Terminal is created

Now save the following bash script in a .sh text file using a code editor.

You can use the following Text code app (


# Update package lists
sudo apt update

# Install Apache2, MariaDB, PHP, and related packages
sudo apt install -y apache2 mariadb-server php libapache2-mod-php php-mysql

# Restart Apache2
sudo systemctl restart apache2

# Secure MariaDB installation
sudo mysql_secure_installation

# Create a database for WordPress
sudo mysql -u root -p -e "CREATE DATABASE wordpressdb;"
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password';"
sudo mysql -u root -p -e "FLUSH PRIVILEGES;"

# Change to web server root directory
cd /var/www/html

# Download and extract WordPress
sudo curl -O
sudo tar -xvf latest.tar.gz
sudo mv wordpress/* .
sudo rm -r wordpress

# Create WordPress configuration
sudo cp wp-config-sample.php wp-config.php
sudo sed -i "s/database_name_here/wordpressdb/g" wp-config.php
sudo sed -i "s/username_here/wordpressuser/g" wp-config.php
sudo sed -i "s/password_here/your_password/g" wp-config.php
sudo sed -i "s/localhost/localhost/g" wp-config.php

# Get the current username

# Change ownership of /var/www/html to the current user
sudo chown $username:$username -R /var/www/html

# Set file permissions
sudo chmod -R 755 /var/www/html/

echo "Moving existing index.html to old.html"
mv index.html old.html

echo "WordPress setup completed!"

echo "Please visit penguin.linux.test to complete installation"

Save the bash script

Save the bash script file with extension ".sh" and copy it to "linux files". I named the file

give execution permissions

Once file is copied to "linux files" you can see the file in terminal when you type ls and press enter. Give execution permission to the .sh bash file.

Run bash script in chromebook

Now you can run the bash script file by typing the following in terminal for your linux container on your Chromebook.

This will install the packages PHP, Apache, and Mariadb, Then Wordpress install wizard will be populated with database information.


While the script is installing mariadb there are some prompts.

Just press enter here

Since this is a local dev environment. Just press enter.

Anonamous User prompt

Remote login prompt

Remove test database

Reload privilege tables

Finally installation complete

Once bash script finishes you can visit http://penguin.linux.test. Start filling in the form for the localhost installation of Wordpress.

Finally installation complete

Happy developing and testing your Wordpress work.


Z Data Tech Last modified: August 15, 2023