- Go to digitalocean.com and hit Create Droplet.
- Name your droplet, select size and region.
- Select ubuntu distribution and lamp application.
- Click Create droplet.
- You will receive an email with ip address and user credentials.
- Download putty from: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- Open putty.
- Put you ip address that you received in the email.
- A terminal (ssh) window will appear.
- Enter
root
as your user name. - Enter the password that you received with the email.
- You will be asked to change your password. Change your password.
- A success message along with the MySQL password will be displayed. Note this password.
- Run
sudo apt-get install phpmyadmin apache2-utils
in the ssh. - Select Apache2 for the server.
- Choose YES when asked about whether to Configure the database for phpmyadmin with dbconfig-common.
- Enter your MySQL password when prompted.
- Enter the password that you want to use to log into phpmyadmin.
- After the installation has completed, you have to add phpmyadmin to the apache configuration. Run
sudo nano /etc/apache2/apache2.conf
to open the apache config file. - Append
Include /etc/phpmyadmin/apache.conf
at the end of the file. - Save and exit the file.
- Restart apache by running
sudo service apache2 restart
.
- Install git by running
sudo apt-get install git
. - Install composer by running
curl -sS https://getcomposer.org/installer | php
. - Move the composer to the bin folder to be able to use it anywhere
sudo mv composer.phar /usr/local/bin/composer
.
Now I want to set up an automated deployment system such that whenever I push a commit to a branch in my repor in bitbucket the server will automatically fetch the changes and thus the site will always be up to date automatically.
-
Go to root directory by running
cd
. -
Create a folder named .ssh by running
mkdir .ssh
. -
Go to the folder just created by running
cd .ssh
. -
Create an ssh key by running
ssh-keygen -t rsa
. -
When a file name is asked, put
bitbucket_rsa
as the file name. -
No need to enter a passphrase for now.
-
To get the public key, run
cat bitbucket_rsa.pub
. -
Copy the key (including the part with
ssh-rsa
). -
Create a file in .ssh folder by running
sudo nano config
. -
Type the following in the file.
Host bitbucket.org IdentityFile ~/.ssh/bitbucket_rsa
-
Save the file.
- Open a browser and log into Bitbucket.
- Choose avatar > Manage Account from the menu bar.
- The system displays the Account settings page. Click SSH keys.
- The SSH Keys page displays. It shows a list of any existing keys. Then, below that, a dialog for labeling and entering a new key.
- Enter a Label for your new key, for example, Default public key.
- Paste the copied public key into the SSH Key field.
- Click the Add key button.
- Test the connection with bitbucket by running
ssh -T git@bitbucket.org
in the server.