I'm just going to give an overview of what's different from that page now:
- When you launch a new EC2 instance, the wizard is now different. You will no longer have a choice between "Classic Wizard", "Quick Launch Wizard" etc.
- Select Ubuntu server 14.04 64-bit with HVM (not PV).
- Remember to add an EBS volume or expand the root volume. I don't recommend expanding root volume, but rather to use another volume to store your data. That way you can wipe you root volume and start over again without data loss. (I almost did, coz I stupidly sudo rm * in an important directory - but I managed to recover.)
- You won't be creating key pairs in the wizard itself. You will be asked to do so after you click on Launch to start up the instance. The procedure to create key pair is still the same.
- Remember to convert the downloaded *.pem file to *.ppk if you want to use PuTTY (my favorite SSH client). There are separate guides available for it.
- WARNING! Half of the commands shown in the guide are to be executed in the local machine, with the other half on the EC2 instance. The guide assumes that your local machine is a Unix/Linux machine, but I'm on Windows. The local machine commands become unnecessary if you're on Windows, and procedures to achieve similar results would be different. For one thing, there's absolutely no notion of "Unix-style permissions" in Windows. If you have a hard time figuring out, here's a rough guide:
- "Connect to server with your PEM Key using SSH" - commands for local machine. Not needed on Windows as you will use PuTTY or some graphical client.
- "Install Linux Apache MySQL PHP (LAMP) Server" - commands for EC2 instance. Just run them once connected by PuTTY.
- "Connecting with SSH without a PEM key" - commands for local machine. I actually skipped this entire section because I don't mind using the PEM key to connect to shell. For Git access, I set up additional user accounts which have password access and are limited to git-shell. More on that below. If you want to do this anyway, you will need to do this on Windows - and yes, you will need to figure out how - or just use PuTTYgen (easy peasy!).
- "Setup GIT for web deployment and version control" - mostly commands for EC2 instance, until it says "local computer". This section should not be followed ditto as it's showing you how to set up a bare Git repo as well as live Git repo, and to link them so they are updated together. Be sure to understand the section well. The mod_rewrite commands at the end are also for EC2 instance.
- The guide uses editors like nano and vi. I stick to using vim for all required edits as it's awesome. If you don't know how to use vim, you should learn. Just Google "vim cheatsheet" and you'll get a lot.
- The added volume will need to be formatted and mounted manually. For this, see the answer here.
- To make things easier, create a group where you will add your Git users. Let's call this group gitusers. So just run sudo addgroup gitusers.
- We will create the users one by one and add them to our gitusers group:
sudo adduser username --ingroup gitusers --shell /usr/bin/git-shell
- Be sure to replace username with the actual username of each user. Execute once per user.
- The --shell part is important so that your new user can only do Git stuff, and not SSH into the server with terminal access.
- Every time you need to add another user, just do this again. To remove a user, you can deluser or just move the user out of the gitusers group.
- Edit using sudo vim (or whatever) the file /etc/ssh/sshd_config
- At the end of the file, add this: (vim tip: press Shift-G to quickly go there, then press i and start typing)
Match Group gitusers
- Save (vim tip: press Esc to exit Insert mode, then type :wq Enter)
- Execute sudo service ssh restart so that ssh will pick up the changes.
sudo chgrp -R gitusers /var/git/
sudo chgrp -R gitusers /var/www/
sudo chmod -R g+w /var/git/
sudo chmod -R g+w /var/www/
Match Group gitusers,gitreadonly
Create the users the same way, except change to --ingroup gitreadonly.
git clone ssh://username@hostname-or-ip-address/path/to/the/repository.git
For a GUI tool, provide repo URL as above (without the git clone part).
Better to install extundelete using sudo apt-get install extundelete so that you can run it if ever you accidentally rm some important file. I accidentally rm'ed the entire /etc/ssh folder contents losing everything, but managed to recover them using this tool.
I also set up and used No-IP service to give my instance a fixed name, so it's reachable by same host name even if I stop and restart it. To have noip2 always start at boot, do sudo crontab -e and add the line:
@reboot sleep 30 && /usr/local/bin/noip2