-
Notifications
You must be signed in to change notification settings - Fork 3
Local Dev with LAMP setup
Aidin Niavarani edited this page Feb 4, 2021
·
1 revision
Piecewise installation of all the individual programs needed to run the Tapestry local development server on Arch Linux:
MariaDB is the 'drop-in' replacement for mySQL on Linux. It's open source and is far better maintained for the platform. Reference
- Install mariadb from the official repositories with
pacman -S mariadb
- Run initial table setup with
mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
- Enable and start
mariadb.service
withsystemctl enable mariadb && systemctl start mariadb
- Login to the database service with the default root account (no password)
mysql -u root -p
- Create a user for use with Wordpress with:
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpresspass';
GRANT ALL PRIVILEGES ON mysql.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
Apache is the industry standard for web-servers and is the robust core of the local dev environment. Reference
- Install apache from the official repositories with
pacman -S apache
- Enable and start the apache
httpd.service
withsystemctl enable httpd && systemctl start httpd
- Verify the service is running correctly by loading localhost in your web browser and checking for the basic index page
By default, Apache will serve the files stored in the srv/http/
directory
A PHP process manager that allows Apache to process and serve PHP files. Reference
- Install php-fpm from the official repositories with
pacman -S php-fpm
- Navigate to your Apache configuration file
httpd.conf
(located at/etc/httpd/conf/httpd.conf
by default) and place the following lines at the top
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Include conf/extra/php-fpm.conf
- Navigate to the extra configuration file directory
extra
(located at/etc/httpd/conf/extra/
by default) and create a new filephp-fpm.conf
with the content:
DirectoryIndex index.php index.html
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
- Edit the
php.ini
file (located at/etc/php/php.ini
by default) to allow connection to mySQL (MariaDB) by uncommenting the lines (At line 923 and 927 for PHP 7):
extension=mysqli
extension=pdo_mysql
- Enable and start the PHP-FPM service with
systemctl enable php-fpm && systemctl start php-fpm
- Restart the Apache
httpd.service
withsystemctl restart httpd
- Download the Wordpress source from the official website
- Make a directory named
wordpress
at/srv/http/
- Extract the source zip to
/srv/http/wordpress/
- Begin the Wordpress setup by navigating to
http://localhost/wordpress
in your web browser - Using the information from the MariaDB setup, fill in form with:
Database Name: mysql
Username: wordpress
Password: wordpresspass
- Follow remaining instructions to setup Wordpress as usual
- After Wordpress is setup, we should increase the file upload size limit in default PHP. Edit the following lines in your
php.ini
:upload_max_filesize = 512M
andpost_max_size = 128M
proFTPd allows the use of FTP to connect to your locally hosted fileserver, aka your computer. Wordpress uses this to make file modifications to its own directory. Reference
- Install proFTPd from the AUR using your helper of choice (yay, aura etc)
- Run the proFTPd setup with
sudo proftpd
- Enable and start the service with
systemctl enable proftpd && systemctl start proftpd
- You can test your connection by running the default
ftp
tool and entering your local user and password
- Clone the tapestry-wp repository into
/srv/http/wordpress/wp-contents/plugins/
- Follow setup instructions in
tapestry-wp/templates/vue/README
- Enter the Wordpress dashboard, open the
plugins
menu on the side and press 'Activate' on the Tapestry plugin - From the
plugins
menu, press 'Add New' at the top and search the store forH5P
, download, install and activate it - Get the GravityForms and GF-Image-Choice zip files and API keys from Asana
- From the 'Add New Plugins' Menu, press 'Upload Plugins' and install each ZIP individually
- When prompted, enter your ftp credentials (local user and password)
- If you get an 'Uploads Directory' permission error, navigate to
/srv/http/wordpress/wp-content/
and run
mkdir uploads
chmod 664 uploads
- Enter the API keys on the Plugins menu
- The last Wordpress setting that requires a change is the Post URL scheme. To change this and allow us to browse to posts, we need to create a
.htaccess
file in thewordpress
directory and give it the proper permissions such that the wp-admin settings panel can make changes to it. Navigate to/srv/http/wordpress/
and enter
touch .htaccess
chmod 664 .htaccess
- Enable the
mod_rewrite
module in your Apache httpd.conf by uncommenting the lineLoadModule rewrite_module modules/mod_rewrite.so
- Allow url override by the .htaccess file by replacing all instances of
AllowOverride none
withAllowOverride all
, all default instances are within<Directory /> ... </ Directory>
tags - Go to the Wordpress admin dashboard, go to Settings > Hyperlinks and pick the "postname" option, then save
- If a change doesn't appear to be having an effect, make sure you've restarted all related services with
systemctl
. Sometimes therestart
command doesn't work as intended, and you should trysystemctl stop
andsystemctl start
- There are well documented issues with Apache and permissions, I recommend reading this StackOverflow post for reference if you run into any such issues
- There are alternatives for a lot of the technologies used and listed here, such as a number of good mySQL replacements, FTP packages and PHP workarounds for Apache. If one technology is posing a lot of issues, reach the Arch wiki for suitable replacements and try that.
Follow the steps here.