Install everything you need to work on TMSTATS on your own Ubuntu image
Follow this guide to install TMSTATS on your Ubuntu image. This will include MySQL, Apache, PHP, necessary Python tools and modules and a copy of the D101TM.ORG WordPress image.
Please note that you do not download this package to your machine until Part II of these instructions!
You need to have a virtual machine (or a real one!) with Ubuntu 20.04 or later. These instructions were written using 20.04 LTS.
You can use either a server or a desktop image; if you use desktop, you will need more storage (both memory and disk space) on your host machine.
Set your VM size to 2GB, and have at least a 25GB Disk. Set your network adapter to "Bridged Network".
Install a "minimal system"; select the "update during installation" and "install 3rd party" checkboxes.
Set your VM size to 1GB, and have at least a 25GB Disk. Set your network adapter to "Bridged Network".
When the system reboots, it will ask you to connect your online accounts - I suggest not doing so.
You can choose whether or not to send reports to Canonical.
After rebooting, the Software Updater will automatically start. Let it update software and then reboot.
I suggest running the Settings program and turning off automatic display blanking.
Log in and issue these commands:
sudo apt-get update
sudo apt-get upgrade
Respond to prompts as needed.
When the installation is finished, reboot.
Issue sudo visudo and change all instances of ") ALL" to ") NOPASSWD:ALL"
Save the file.
You want to install the VirtualBox Guest Additions before you proceed further. Check the VirtualBox documentation for the most current information, but as of the time I wrote this, all you have to do is go to the "Devices" menu for your VM and insert the Guest Additions image; let it install itself and reboot.
If you are using a shared folder with your guest, you also need to give yourself access to the folder. Issue this command:
sudo adduser $USER vboxsf
Go to the Machine/Settings/General/Advanced menu item and enable a bidirectional clipboard and drag-and-drop if desired.
You can eject the Guest Additions DVD from your virtual machine at this point.
Proceed according to that program's instructions.
Issue sudo apt-get install openssh-server to install the SSH server and start it.
If you already have a public/private key pair (~/.ssh/id_rsa and ~/.ssh/id_rsa.pub) on your host machine, copy them to ~/.ssh/ on the guest, then issue this command on the guest:
cd ~/.ssh;cat id_rsa.pub >> authorized_keys
That will allow you to SSH into the guest from your host machine, and if you have your public key in ~/.ssh/authorized_keys on the host, you can go the other way (this is mostly useful for copying files).
You will need to generate a keypair on the guest machine. This page is a guide to doing so. In short:
- Issue
ssh-keygen - Hit RETURN for all the prompts, accepting the default location and not creating a passphrase.
- Issue
cd ~/.ssh;cat id_rsa.pub >> authorized_keys
If you want to use the keys you've just generated on your host system, copy them to ~/.ssh on that system and add the id_rsa.pub file to the host's authorized_keys.
Step 6: Send your PUBLIC key to webmaster@d101tm.org
Send an email to webmaster@d101tm.org and attach (or just copy in) ~/.ssh/id_rsa.pub I will add your public key to the necessary files on d101tm.org and let you know when it's ready to use.
Follow the procedure here.
This will give you access to all of the files in the webserver's directory. Issue:
sudo adduser $USER www-data
Install git:
sudo apt-get install git
Tell Git your email address and name:
git config --global user.name "Your Name"
git config --global user.email "user@domain"
Create a directory to hold the Git repositories:
mkdir ~/src
This will give you a good recovery point if you need it. Restarting the VM also ensures that your user is an active member of any groups you added it to.
Shutdown the VM (issue sudo poweroff) and take a snapshot.
Now, you need to wait until the Webmaster tells you your public key has been added to the server.
Reboot your machine and log in.
Make sure your public key has been added to the server by issuing this command:
ssh d101dev@d101tm.org 'echo Remote user is $USER'
You may get a prompt like this:
The authenticity of host 'd101tm.org (69.163.170.135)' can't be established.
ECDSA key fingerprint is SHA256:rWqwh967MZCQNhaBNBJ6bFWInpLjUkk1l+LW2VZD1+E.
Are you sure you want to continue connecting (yes/no)?
Reply 'yes'; the system will tell you that it's added the key to the list of known hosts.
You should see a message: Remote user is d101dev. If so, you're properly set up and can continue; otherwise, check with the Webmaster to make sure your public key has been added to the server.
Log into GitHub and make a fork of d101tm/tmstats. This will be where you do your development and debugging; when you want to get your work onto the production server, you'll push it to your fork and make a pull request to have it merged into the d101tm/tmstats repository. This will give someone else on the team a chance to look at your code (especially for major changes) before we put it into production.
Once you fork the code on GitHub, clone it to the VM with this command (replace USERNAME with your GitHub username, of course):
cd ~/src
git clone git@github.com:USERNAME/tmstats.git
You may get a prompt like this:
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
Reply 'yes'; the system will tell you that it's added the key to the list of known hosts.
cd ~/src
git clone git@github.com:d101tm/setuptmstats.git
Issue these commands:
cd ~/src/setuptmstats
./fullinstall > install.log
This will install and configure Apache, MySQL, PHP, Python, the D101TM.ORG website and code, and the TMSTATS code and data. Detailed output will be in install.log; you will get progress reports on your screen. If there are any prompts, reply appropriately (but I hope there aren't).
If you want to be able to access your site from elsewhere on your network, issue this command:
sudo ufw allow http
That will allow http requests INTO your virtual machine.
From time to time, you may need to pull the most current code (either all or some modules) from the version that's being used by d101tm.org itself. To do this, issue these commands:
cd ~/src/tmstats
git remote add upstream https://github.com/d101tm/tmstats.git
Make sure that everything is properly defined:
git remote -v
The response should look like this:
origin git@github.com:USERNAME/tmstats.git (fetch)
origin git@github.com:USERNAME/tmstats.git (push)
upstream https://github.com/d101tm/tmstats.git (fetch)
upstream https://github.com/d101tm/tmstats.git (push)
with your Git username instead of USERNAME.
This lets you compare or pull code from the "real" master repository, which
will have the nickname of upstream/master.
This includes the TMSTATS code (in ~/src/tmstats).
The administrator of the WordPress site is 'd101dev' with a password of 'd101dev'.