In broad strokes, this is what we want to do:
Update your system apt-get update && apt-get upgrade
Install the required packages apt-get install unzip vim apache2 libapache2-mod-php5 mysql-server php5-curl php5-mcrypt php5-gd php5-mysql
Secure your mysql install
Edit /root/.my.cnf in case you want to get into Mysql from the console without typing a password vim /root/.my.cnf
[client]
user = root
password = <YourPassword>
Create the database To get in: mysql
To create the database: mysql> create database anchor; quit
Check your firewall to allow for ports SSH and HTTP outbound ufw status
or iptables -nvL
Get anchor cd /var/www/html; wget http://anchorcms.com/download -O anchor.zip; unzip anchor.zip
Adjust permissions chown -R www-data:www-data anchor-cms
Setup apache to allow for .htaccess sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
Enable apache modules a2enmod rewrite
Add the .htaccess to the base directory ( /var/www/html/anchor-cms/.htaccess )
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
Restart services service apache2 restart; service mysql-server restart
Go to http://
So I spent an afternoon and got it done using Ansible! This is version 1 so Iām sure it can be vastly improved. Oh! And it has a Vagrantfile in case you want to try it out locally with vagrant up
.
You can see the code here or the Galaxy role here!
There is one step that I could not automate because it has to be done after the configuration and installation process of Anchor itself which you can do manually:
rm -rf /var/www/html/anchor-cms/install
Enjoy!