It's no secret that I'm a big fan of Craft CMS; so big that, when the opportunity presented itself, I didn't hesitate to shift my work's website onto the system as well. Unfortunately, whilst my personal installation of Craft has been sailing along smoothly, our hosting provider at work has been a little trickier. The initial install was a bit bumpy, but the big issue has been updates: every time we've ran an update it's been a coin toss over whether the site would crash or not - hardly ideal!
Luckily, as part of a larger project, we've just been able to switch hosts. Whilst I was tempted to stick with what I know and move their CMS onto Smart Hosting (which runs theAdhocracy without any updating issues), the reality is that their usage will always be more intense then my own. After a bit of research, we settled on Arcustech and, for the most part, I've been pretty happy with that decision so far. The CMS is fast on their servers and cost is still extremely competitive, even if it is a little dearer than Smart Hosting. However, I'm by no means a SysAdmin and whilst I have technically ran a personal server in the past, my knowledge of using these managed service VPS plans is exactly nil, so it was a little terrifying getting off the ground.
Surprisingly, despite being an extremely well known host within the Craft community and an official Craft partner, Arcustech don't have a guide to installing Craft on their service. I wouldn't put that as a black mark against them, as their help pages are actually extremely well written and pretty comprehensive, it's just that their expected user would already know all of that. Basically, if you're using their hosting services it's fair to assume that you know what you're doing... only, I don't (or at least, didn't). It's therefore been a bit of trial and error, leading to a few dead-ends along the way, but ultimately I have managed the most basic stage of installing the CMS and getting it to run. For future reference, and for anyone else out there at the same end of the learning curve as me, I figured I'd record what those steps were - well, the ones that worked at least 😂.
Quick aside: I'm doing all of this from Windows 10. Some commands on OSx may be different.
Setting up the Domain
First things first, you need to get a few pieces in place before we begin, the most important of which is ensuring that you have the correct hosting package. As an official Craft Hosting Partner, Arcustech have dedicated Craft CMS VPS plans, and that distinction is noteworthy as it fundamentally changes your server's directory structure and the tools you'll have access to. For complete clarity, the following steps are intended for people using their Craft NANO or Craft VPS plans (see here); we use the NANO 1GB but I believe they should all be the same. If you're just purchasing the plan now, be aware that it can take up to 24hours for Arcustech to actually set up the account; you'll get an email once it's all done, but until you have that information you won't be able to go any further.
That email will contain some key bits of information, including your username, login link, SSH and database passwords, and IP address. Once you have all of those, you can set up your primary domain. Arcustech have their own documentation for that, but the basic gist is: login to wherever you manage your DNS records, create a new "A" record (or update an existing one), and point it at the IPv4 address for your hosting account. You'll then probably need to wait another day or so for those records to propagate. As an FYI, we didn't want to use a true domain name, as our CMS is a headless install and the real root domain is pointed elsewhere. All we did was create a new "A" record for cms.domainname.tld and point that at the relevant IP address, which worked a treat.
To test your domain is working correctly, we need to first connect to the server, which means setting up an sFTP connection. Personally, I still use FileZilla for this, but feel free to connect however you prefer. There's a bunch of information provided by Arcustech for different options. In FileZilla, it's as simple as putting your IPv4 address into the Host box, your hosting account name as username, your password as provided in the sign up email, and choosing port 22, then hitting connect. You can now test the domain is working by uploading a simple index.html file to server. Just pop it into the www/public_host/public folder for now; you can get a basic template to test with from W3Schools. Now, when you navigate to your domain or subdomain, you should see that file being rendered; if not, chances are the DNS changes haven't propagated yet, so just wait a few more hours and try again.
Preparing for Craft
Next, we need to get onto the server via SSH, which will allow us to prepare it for the Craft installation process. Open a new terminal in whatever program you prefer; the simplest way on Windows is just to run cmd to open the inbuilt CLI. Once open, connect by typing the following (replacing with your account details):
$ ssh username@ipv4address
You'll then be prompted for your SSH password. If it requests a port, select 22 (but I don't think this should happen). There's a bunch of info on SSH CLI commands in the Arcustech Knowledge Base if you want to know anything else.
Once you're connected, it's worth just confirming Composer is correctly installed, which should be the case if you have a Craft hosting plan. To check, just type:
$ composer -v
into the terminal. You should get something like this returned (only a lot longer):
If you don't, you'll need to get in touch with Arcustech as something has gone wrong. If you do, then you can move on to setting up your database for the Craft install. In the same terminal, type:
$ mysql -u username -p
Replacing username with your account username. Again, see this piece of documentation for more info. Once you've entered your password, you can use the command:
mysql> show tables;
To return the current tables, which should look something like this:
To create your new Craft database, simply type:
mysql> create database 'username_craft';
Where you replace username with your hosting account username (e.g. av#####). You can also change the "_craft" part to whatever name you want the Craft database to be. You should see a message return pretty much instantly saying Query OK, 1 row affected (0.00 sec). To confirm that, rerun the command above to show the database tables again, and you should see your "_craft" database in that list.
With all that done and checked, we can finally install Craft itself! Open a new terminal and SSH onto the server using the same method as above. Now navigate to the correct folder by typing:
$ cd www
And then create a new Craft install via Composer (for further info see the Craft CMS installation guide and follow the CLI steps):
$ composer create-project craftcms/craft
You don't need to specify the <Path> as we're already in the correct location. You should see a message pop up saying that the installation has begun, so sit back and wait for this to finish. You'll know it's done because this ASCII art will appear:
Congratulations, Craft is installed! Except, if you actually go to your domain, you won't be able to access it. That's because the folder structure is wrong right now, so reconnect via sFTP as we did above and navigate into the www folder. You'll see two subfolders: "craft" and "public_html". Rename or delete the "public_html" folder, as we don't need it any more. Once that's done, rename the "craft" folder to "public_html".
Now navigate into that folder and rename the "web" subfolder to "public". You should now be done! 🎉🎉🎉 If you go to the following web address:
You should get the standard Craft install screen and can follow the steps as outlined in the Craft documentation here. When you come to connecting to the database, make sure MySQL is selected, set the server to localhost and the port to 3306, then put your account username and password in as you've used before. The database name will be as we set above (there's no prefix). The rest of the settings are up to you 😉