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
Open the terminal app and click
Clicking setup will take you to settings window where you can click "turn on" to have your Chromebook create a linux container.
This opens the setup wizard for you to configure the size and account name for the development environment.
Since your container is just for testing things out in a baseline sandbox leaving the size to 10gb would be fine.
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 (https://chrome.google.com/webstore/detail/text/mmfbcljfglbokpmkimbfghdkjmjhdgbg)
#!/bin/bash
# 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 https://wordpress.org/latest.tar.gz
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
username=$(whoami)
# 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 install-wordpress-linux-container.sh
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.
/bin/sh install-wordpress-linux-container.sh
While the script is installing mariadb there are some prompts.
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.