{"id":1104,"date":"2021-10-02T14:37:00","date_gmt":"2021-10-02T21:37:00","guid":{"rendered":"https:\/\/blog.colterhicks.com\/2021\/10\/02\/raspberry-pi-wordpress-lamp-server-just-the-commands-you-need-to-make-it-happen\/"},"modified":"2025-09-14T23:13:40","modified_gmt":"2025-09-15T06:13:40","slug":"raspberry-pi-wordpress-lamp-server-just-the-commands-you-need-to-make-it-happen","status":"publish","type":"post","link":"https:\/\/blog.dabbleden.com\/index.php\/2021\/10\/02\/raspberry-pi-wordpress-lamp-server-just-the-commands-you-need-to-make-it-happen\/","title":{"rendered":"Raspberry Pi WordPress LAMP server &#8211; JUST the commands you need to make it happen"},"content":{"rendered":"\n<p>If you have a Raspberry Pi and would like to turn it into a web server to host your own WordPress website, here are all the commands to make that happen. There is no fluff, just copy the commands one-by-one and you&#8217;ll have your site up and running in no time!<\/p>\n\n\n\n<!--more-->\n\n\n\n<h1 class=\"wp-block-heading\">INSTALLING ALL APPS<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div><br><div>sudo apt update &amp;&amp; upgrade<\/div><br><div>sudo apt install apache2<\/div><br><div>sudo apt install mariadb-server<\/div><br><div>sudo mysql_secure_installation<\/div><br><div>sudo apt install php-fpm php-mysql<\/div><br><div>sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip<\/div><br><div>sudo systemctl restart apache2<\/div><br><\/div><\/code><\/pre>\n\n\n\n<p><a name=\"more\"><\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">MySQL CONFIGURATION<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo mysql<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>CREATE USER&nbsp; 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD';<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>GRANT ALL ON wordpress.* TO 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>FLUSH PRIVILEGES;<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>mariadb -u USERNAME -p<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>SHOW DATABASES;<\/div><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">ALLOW PERMISSIONS TO THE MAIN WEBSITE DIRECTORY<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo mkdir \/var\/www\/<strong>yourdomain.com<\/strong><\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo chown -R $USER:$USER \/var\/www\/<strong>yourdomain.com<\/strong><\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo chown -R www-data:www-data \/var\/www\/<strong>yourdomain.com<\/strong><\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo find \/var\/www\/<strong>yourdomain.com<\/strong> -type d -exec chmod 750 {} ;<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo find \/var\/www\/<strong>yourdomain.com<\/strong> -type f -exec chmod 640 {} ;<\/div><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">SERVER CONFIGURATION<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo nano \/etc\/apache2\/sites-available\/<strong>yourdomain.com<\/strong>.conf<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>&lt;Directory \/var\/www\/<strong>yourdomain.com<\/strong>&gt;<br>AllowOverride All<br>&lt;\/Directory&gt;\n<p>&nbsp;<\/p>\n<p>&lt;VirtualHost *:80&gt;<br>ServerName <strong>yourdomain.com<\/strong><br>ServerAlias www.<strong>yourdomain.com<\/strong><br>ServerAdmin <strong>USERNAME<\/strong>@localhost<br>DocumentRoot \/var\/www\/<strong>yourdomain.com<\/strong><br>ErrorLog ${APACHE_LOG_DIR}\/error.log<br>CustomLog ${APACHE_LOG_DIR}\/access.log combined<br>&lt;\/VirtualHost&gt;<\/p>\n<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div><b><i>*Ctrl-X, Y, Enter*<\/i><\/b><\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo nano \/var\/www\/<strong>yourdomain.com<\/strong>\/.htaccess<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt;<br>RewriteEngine On<br>RewriteBase \/<br>RewriteRule ^index.php$ - &#91;L]<br>RewriteCond %{REQUEST_FILENAME} !-f<br>RewriteCond %{REQUEST_FILENAME} !-d<br>RewriteRule . \/index.php &#91;L]<br>&lt;\/IfModule&gt;<br># END WordPress<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div><b><i>*Ctrl-X, Y, Enter*<\/i><\/b><\/div><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">ENABLE SITE ON SERVER<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo a2enmod rewrite<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo a2ensite <strong>yourdomain.com<\/strong><\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo a2dissite 000-default<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo systemctl reload apache2<\/div><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">INSTALL WORDPRESS<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>cd \/var\/www<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo wget <a href=\"https:\/\/wordpress.org\/latest.tar.gz\">https:\/\/wordpress.org\/latest.tar.gz<\/a><\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo tar -xzvf latest.tar.gz<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo rm latest.tar.gz<\/div><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo mv wordpress <strong>yourdomain.com<\/strong><\/div><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">RELOAD APACHE TO ENSURE ALL SERVICES ARE STARTED<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div>sudo systemctl reload apache2<\/div><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">REMINDER<\/h1>\n\n\n\n<pre class=\"wp-block-code has-ast-global-color-8-background-color has-background\"><code><div><!--wp:paragraph-->\n<p>&nbsp;<\/p>\n<p>*Verify port 80 AND 443 are forwarded on the router to your device*<\/p>\n<p><!--\/wp:paragraph--> <!--wp:paragraph--><\/p>\n<p>*Remember to change your WordPress General settings to use https:\/\/ instead of http:\/\/*<\/p>\n<p><!--\/wp:paragraph--> <!--wp:paragraph--><\/p>\n<p>___________<\/p>\n<h1 style=\"text-align: left;\">INSTALL LETSENCRYPT FOR SSL\/HTTPS<\/h1>\n<div>sudo apt install snapd<\/div>\n<div>sudo reboot<\/div>\n<div>sudo snap install core; sudo snap refresh core<\/div>\n<div>sudo apt-get remove certbot<\/div>\n<div>sudo snap install --classic certbot<\/div>\n<div>sudo ln -s \/snap\/bin\/certbot \/usr\/bin\/certbot<\/div>\n<div>sudo certbot --apache<\/div>\n<p><\/p><wp-block data-block=\"core\/more\"><\/wp-block>\n<div>&nbsp;<\/div>\n<h3 style=\"text-align: left;\">These last two commands are optional if you want to test the cert but will not affect functionality<\/h3>\n<div>sudo certbot certonly --apache<\/div>\n<div>sudo certbot renew --dry-run<\/div>\n<p><\/p><wp-block data-block=\"core\/more\"><\/wp-block>\n<div>&nbsp;<\/div>\n<h3 style=\"text-align: left;\">If you followed these instructions line-by-line, you should have a full website with SSL\/HTTPS enabled and are ready to start blogging on WordPress!<\/h3>\n<h3 style=\"text-align: left;\">Remember to install security plugins for your site and not to enable any other ports other than 80 and 443 through your home router.<\/h3>\n<h3 style=\"text-align: left;\">Let me know if you make a website and link it in the comments! I'd love to see what you do!<\/h3>\n<p><!--\/wp:paragraph--><\/p>\n<\/div><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you have a Raspberry Pi and would like to turn it into a web server to host your own WordPress website, here are all the commands to make that happen. There is no fluff, just copy the commands one-by-one and you&#8217;ll have your site up and running in no time!<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[14,17],"tags":[32,40,43,47],"class_list":["post-1104","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","category-webservices","tag-lamp","tag-pi","tag-server","tag-web"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/posts\/1104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/comments?post=1104"}],"version-history":[{"count":1,"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/posts\/1104\/revisions"}],"predecessor-version":[{"id":4704,"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/posts\/1104\/revisions\/4704"}],"wp:attachment":[{"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/media?parent=1104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/categories?post=1104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.dabbleden.com\/index.php\/wp-json\/wp\/v2\/tags?post=1104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}