ServerPilot
ServerPilot copied to clipboard
Setup ServerPilot with Vagrant
Setup ServerPilot with Vagrant
This repository provides a sample Vagrantfile to create a Ubuntu 14.04 64-bit virtual machine. After following the installation instructions, you'll have a server managed by ServerPilot and accessible via your browser at local.io
.
Inspired from manjoker/Vagrantfile
https://serverpilot.io
Information
You will be able to setup as many sub-domain as you want. You will have phpMyAdmin running on your server and you will also be able to share your virtual machine with https://vagrantcloud.com
Getting Started
- Install dependencies
- Virtualbox 4.0 or greater.
- Vagrant 1.3.1 or greater.
- Copy the Vagrantfile
- Execute the following commands to setup the virtual machine :
$ vagrant up
$ vagrant ssh
Connecting to ServerPilot
-
Log in to ServerPilot
-
Go to the Servers page and click + Connect Server
-
Click
Install ServerPilot manually.
at the bottom-
Name
=>local.io
-
SFTP Password
=>Choose a password
-
-
Copy the whole command (and let the page open in your browser):
-
Paste the command in the VM terminal and wait until to get this message :
-
Watch ServerPilot install
-
Note : The part
Testing server configuration
may take several minutes (more than 20 minutes for me)
Create your Applications in ServerPilot
- Go to the Apps page and click + Create App
-
Name
=>website
-
Domain
=>local.io
-
Server
=>local.io
-
Edit the hosts
file
- Edit the following file as
administrator
/root
- Ubuntu/Mac OS X :
/etc/hosts
- Windows :
C:\WINDOWS\system32\drivers\etc\hosts
- Ubuntu/Mac OS X :
- Add the following code in this file :
-
192.168.56.101 local.io
- If you plan to add sub-domains, you can add them now in the
hosts
file :
-
192.168.56.101 local.io
192.168.56.101 subdomain1.local.io
192.168.56.101 subdomain2.local.io
Edit the Vagrantfile
file
- Now, you must edit the
Vagrantfile
and uncomment this line :
config.vm.synced_folder '/var/www/Sites/website', '/srv/users/serverpilot/apps/website/public', owner: "serverpilot", group: "serverpilot"
- Adapt it to your system. The first part, is the path on your system. The second part, is the path on the VM system.
-
Note : Don't remove the
owner
andgroup
keys. I have got some issues with the permissions, and this configuration seems to resolve all permissions bugs. If you want to add newsynced_folder
, you must add theowner
andgroup
keys with theserverpilot
value.
-
Note : Don't remove the
- Execute the following command to reload the VM with the modified Vagranfile :
vagrant@local:~$ exit
$ vagrant reload
Enjoy
- Go to local.io in a new tab and you should see the ServerPilot splash page or your application.
More Configuration
The following configuration are not required, but can be usefull if you plan to install phpMyAdmin or setup a sub-domain.
Install phpMyAdmin
- Create a new application on ServerPilot :
-
Name
=>pma
-
Domain
=>pma.local.io
-
Server
=>local.io
-
- Download the latest version of
phpMyAdmin
:- http://www.phpmyadmin.net/home_page/downloads.php
- Open the archive that you downloaded
- Place the archive where you want on your system. For the tutorial, i have placed it in
/var/www/Sites/pma
. - Rename
config.sample.inc.php
toconfig.inc.php
. - Now, open
config.inc.php
and set a random string of characters for the value of$cfg['blowfish_secret']
near the top of the file. Exemple :
$cfg['blowfish_secret'] = 'asdof7q230984(*^3q4';
- Add
192.168.56.101 pma.local.io
to yourhosts
file. - Uncomment and adapt (regarding to the path) the following line in the Vagranfile :
config.vm.synced_folder '/var/www/Sites/pma', '/srv/users/serverpilot/apps/pma/public', owner: "serverpilot", group: "serverpilot"
- Execute the following command to reload the VM with the modified Vagranfile :
$ vagrant reload
-
Create a database on ServerPilot :
-
Go to pma.local.io and login with the same
username
andpassword
that you used to create the database.
Create a sub-domain
- If you followed the phpMyAdmin installation, you already know how to setup a sub-domain. For the tutorial, I will setup a sub-domain named
xety.local.io
- Create a new application on ServerPilot :
-
Name
=>xety
-
Domain
=>xety.local.io
-
Server
=>local.io
-
- Add
192.168.56.101 xety.local.io
to yourhosts
file. - Uncomment and adapt (regarding to your path) the following line in the Vagranfile :
config.vm.synced_folder '/var/www/Sites/xety', '/srv/users/serverpilot/apps/xety/public', owner: "serverpilot", group: "serverpilot"
- Execute the following command to reload the VM with the modified Vagranfile :
$ vagrant reload
- Go to xety.local.io and enjoy ! Yes, it's very simple to do.
Connect to the SFTP
Yes, you can connect to the server using the SFTP method !
- Use your prefered software. I will use
FileZilla
. - Login in FileZilla with the following credentials :
-
Host
=>192.168.56.101
-
User
=>serverpilot
-
Password
=>The SFTP password that you provided at the beginning of this tutorial
-
Port
=>22
-
- You can also login with the
vagrant
user :-
Host
=>192.168.56.101
-
User
=>vagrant
-
Password
=>vagrant
-
Port
=>22
-
- But i recommend you to use the
serverpilot
user and not thevagrant
, else you will probably have some permissions issues (i.e : https://serverpilot.io/community/articles/how-to-fix-file-permissions.html)
Share your VM
- Create an account there : https://vagrantcloud.com/account/new
- It's easy with 1 command, follow the
HTTP
method there : https://vagrantcloud.com/help/vagrant/shares/create - Possible issue :
-
Why the share doesn't show the good application ?
=> Because ServerPilot define the default application by alphabetically order. More information : https://serverpilot.io/community/articles/how-to-set-the-default-app.html
-