Test Server Installation and Configuration: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
== Front Matter == | == Front Matter == | ||
The following instructions will walk you through installing and configuring an AppStudio Test Server. They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise. You will be installing Ubuntu Server, which is a Linux distribution. You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote | The following instructions will walk you through installing and configuring an AppStudio Test Server. They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise. You will be installing Ubuntu Server, which is a Linux distribution. You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into. These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server. | ||
=== Determining the CPU Type === | === Determining the CPU Type === | ||
Line 12: | Line 12: | ||
Most modern CPUs are 64-bit. | Most modern CPUs are 64-bit. | ||
These instructions have not been tested on a 32-bit machine. However, they should work with minimum changes. If you are planning to install on a 32-bit machine, you | These instructions have not been tested on a 32-bit machine. However, they should work with minimum changes. If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso | ||
== Create Bootable Media == | == Create Bootable Media == | ||
Line 27: | Line 27: | ||
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html | More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html | ||
# Boot your Ubuntu media. This may require you to either hold down a key during boot | # Boot your Ubuntu media. This may require you to either hold down a key during boot or change the boot device order in the BIOS settings. Instructions vary depending on your model of server. | ||
# You will be prompted to choose a language. Choose the appropriate language. | # You will be prompted to choose a language. Choose the appropriate language. | ||
#:[[File:Screenshot.png]] | #:[[File:Screenshot.png]] | ||
Line 36: | Line 36: | ||
# Select your location. | # Select your location. | ||
#:[[File:Screenshot.png]] | #:[[File:Screenshot.png]] | ||
# Select your keyboard layout | # Select your keyboard layout by allowing the installer to auto-detect it. | ||
#:[[File:Screenshot.png]] | #:[[File:Screenshot.png]] | ||
# At this point, your server will try to configure its network connection. Generally, the network will be configured automatically. If | # At this point, your server will try to configure its network connection. Generally, the network will be configured automatically. If your network configuration fails, you will have to configure it manually. Speak to your network administrator or hosting company for the proper configuration values. | ||
# Enter a hostname for this machine. If this machine has a name on your network, | # Enter a hostname for this machine. If this machine already has a name on your network, use that. This does not include the domain name. For example, "server01" and not "server01.example.com". | ||
#:[[File:Screenshot.png]] | #:[[File:Screenshot.png]] | ||
# Enter in the real name of the initial user. | # Enter in the real name of the initial user. | ||
#:[[File:Screenshot.png]] | #:[[File:Screenshot.png]] | ||
# Choose a name for the initial user. This user will have administrative privileges | # Choose a name for the initial user. This user will have administrative privileges but will not be a super-user. | ||
#:[[File:Screenshot.png]] | #:[[File:Screenshot.png]] | ||
# Choose a password for the initial user. | # Choose a password for the initial user. | ||
Line 72: | Line 72: | ||
== Domain Names == | == Domain Names == | ||
The remainder of these instructions assume you have a host and domain name configured externally for the server. A domain name server maps the server's IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is "fully qualified"). If | The remainder of these instructions assume you have a host and domain name configured externally for the server. A domain name server maps the server's IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is "fully qualified"). If you don't have an external domain name server, some of the following instructions will not work. You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the "hosts" file of the computer from which you will be configuring the server. The following link describes how to modify your "hosts" file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file | ||
Add the following entry into the "hosts" file: | |||
<pre> | <pre> | ||
Line 80: | Line 80: | ||
</pre> | </pre> | ||
Replace 10.1.1.2 with the IP address of your server | Replace 10.1.1.2 with the IP address of your server and "server01" with the host name of your server. | ||
== Remote Access == | == Remote Access == | ||
At this point you should be able to login to your server using SSH. SSH stands for secure shell. It allows you to bring up a command prompt from another machine. If you are on Mac OS or Linux, you can | At this point, you should be able to login to your server using SSH. SSH stands for secure shell. It allows you to bring up a command prompt from another machine. If you are on Mac OS or Linux, you can open a Terminal and type: | ||
<pre> | <pre> | ||
Line 90: | Line 90: | ||
</pre> | </pre> | ||
Replace "user" with the user you created while installing | Replace "user" with the user you created while installing and "server01" with your server's hostname. | ||
If you are on | If you are on Windows, it's suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html | ||
If you can't login, there's a chance there's a problem with your network configuration. SSH uses port 22. Verify it's not being blocked by a firewall by speaking with your network administrator. | If you can't login, there's a chance there's a problem with your network configuration. SSH uses port 22. Verify it's not being blocked by a firewall by speaking with your network administrator. | ||
Line 172: | Line 172: | ||
</pre> | </pre> | ||
Finally restart apache: | Finally, restart apache: | ||
<pre> | <pre> | ||
Line 178: | Line 178: | ||
</pre> | </pre> | ||
Verify that you receive an empty folder listing when navigating to your server in a web browser. Verify that if you put a file in the document root (using touch, for | Verify that you receive an empty folder listing when navigating to your server in a web browser. Verify that if you put a file in the document root (using touch, for example), that file is now shown in the folder. | ||
=== Configuring VSFTPD === | === Configuring VSFTPD === | ||
Line 198: | Line 198: | ||
</pre> | </pre> | ||
Add an FTP user to the system, setting | Add an FTP user to the system, setting its home folder to "/srv/ftp/./home" without quotes: | ||
<pre> | <pre> | ||
Line 229: | Line 229: | ||
</pre> | </pre> | ||
Copy the as folder from your install inside the newly created 3.3.x folder. You may need to first upload the folder to your home directory using an SFTP client and then use sudo to cp the folder as root. | Copy the "as" folder from your install inside the newly created 3.3.x folder. You may need to first upload the folder to your home directory using an SFTP client and then use sudo to cp the folder as root. | ||
=== Configuring incron === | === Configuring incron === | ||
Line 300: | Line 300: | ||
=== Verification === | === Verification === | ||
If the system is working properly | If the system is working properly, a symbolic link to the template should have appeared in your project's folder after uploadng. Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed. |
Revision as of 03:45, 20 January 2014
Front Matter
The following instructions will walk you through installing and configuring an AppStudio Test Server. They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise. You will be installing Ubuntu Server, which is a Linux distribution. You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into. These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.
Determining the CPU Type
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number. You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key. Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600. Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel's site. For instance:
- 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb
- 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb
Most modern CPUs are 64-bit.
These instructions have not been tested on a 32-bit machine. However, they should work with minimum changes. If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso
Create Bootable Media
- Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso
- Determine if you will be writing the ISO file to a CD or a USB drive.
- CD: simply write the ISO image to a writable CD. Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto
- USB drive: writing to a USB drive can be a bit tricky. It's suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home). Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick
Install Ubuntu
This section assumes you have physical access to the machine. Generally, a virtual server host will automate this step.
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html
- Boot your Ubuntu media. This may require you to either hold down a key during boot or change the boot device order in the BIOS settings. Instructions vary depending on your model of server.
- You will be prompted to choose a language. Choose the appropriate language.
- Choose the option "Install Ubuntu Server"
- Select your language once again.
- Select your location.
- Select your keyboard layout by allowing the installer to auto-detect it.
- At this point, your server will try to configure its network connection. Generally, the network will be configured automatically. If your network configuration fails, you will have to configure it manually. Speak to your network administrator or hosting company for the proper configuration values.
- Enter a hostname for this machine. If this machine already has a name on your network, use that. This does not include the domain name. For example, "server01" and not "server01.example.com".
- Enter in the real name of the initial user.
- Choose a name for the initial user. This user will have administrative privileges but will not be a super-user.
- Choose a password for the initial user.
- Choose to not encrypt your home folder.
- Choose to use Guided Partitioning, using the entire disk, with LVM.
- Select the proper disk.
- Write the changes to disk.
- Choose to use the entire disk again.
- Verify you will write changes to the disk again. The base system should now install.
- Setup an HTTP proxy, if you need one.
- Choose to install automatic updates.
- Choose to install the OpenSSH server.
- Install GRUB to the master boot record.
- Reboot.
Domain Names
The remainder of these instructions assume you have a host and domain name configured externally for the server. A domain name server maps the server's IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is "fully qualified"). If you don't have an external domain name server, some of the following instructions will not work. You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the "hosts" file of the computer from which you will be configuring the server. The following link describes how to modify your "hosts" file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file
Add the following entry into the "hosts" file:
10.1.1.2 server01
Replace 10.1.1.2 with the IP address of your server and "server01" with the host name of your server.
Remote Access
At this point, you should be able to login to your server using SSH. SSH stands for secure shell. It allows you to bring up a command prompt from another machine. If you are on Mac OS or Linux, you can open a Terminal and type:
ssh user@server01
Replace "user" with the user you created while installing and "server01" with your server's hostname.
If you are on Windows, it's suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html
If you can't login, there's a chance there's a problem with your network configuration. SSH uses port 22. Verify it's not being blocked by a firewall by speaking with your network administrator.
Configuring
Once your computer has rebooted, login using the username and password you created during the install process. The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting. If you aren't comfortable with these topics, here are several tutorials that may help:
- https://help.ubuntu.com/community/UsingTheTerminal
- https://help.ubuntu.com/community/CommandlineHowto
- https://help.ubuntu.com/community/Beginners/BashScripting
Update Packages
At the command prompt, type the following:
sudo aptitude update sudo aptitude full-upgrade
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:
sudo aptitude install apache2 vsftpd
Finally, reboot:
sudo reboot
Configure Apache
From the command prompt, switch to the following folder:
cd /etc/apache2/sites-available
Create a new site by creating a new text file:
sudo nano asserver
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:
<VirtualHost *:80> ServerAdmin admin@example.com ServerName www.example.com ServerAlias example.com DocumentRoot /srv/ftp/home <Directory /srv/ftp/home/> Options FollowSymLinks AllowOverride None Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Save the file using Ctrl-O. Next, make the document root specified above:
sudo mkdir -p /srv/ftp/home
Finally, restart apache:
sudo /etc/init.d/apache2 restart
Verify that you receive an empty folder listing when navigating to your server in a web browser. Verify that if you put a file in the document root (using touch, for example), that file is now shown in the folder.
Configuring VSFTPD
Using nano, make the following modifications to /etc/vsftpd.conf:
- Uncomment write_enable=YES
- Change anonymous_enable=YES to anonymous_enable=NO
- Uncomment local_enable=YES
- Uncomment local_umask=022
- Add the following lines:
delete_failed_uploads=YES pasv_min_port=50000 pasv_max_port=50100 port_enable=NO chroot_local_user=YES passwd_chroot_enable=YES
Add an FTP user to the system, setting its home folder to "/srv/ftp/./home" without quotes:
sudo adduser ftpuser
Restart vsftpd:
sudo /etc/init.d/vsftpd restart
Verify you can upload files by connecting via FTP as the user you just completed. They should appear in the web root.
Creating the proper folder structure
Start by creating the folders to support template uploads and setting their permissions:
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED sudo mkdir -p /srv/ftp/templates sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED
Make template folders for all the versions of AppStudio you wish to support - for instance:
sudo mkdir -p /srv/ftp/templates/3.3.x
Copy the "as" folder from your install inside the newly created 3.3.x folder. You may need to first upload the folder to your home directory using an SFTP client and then use sudo to cp the folder as root.
Configuring incron
First, create the link script in the template folder with the following command:
sudo nano /srv/ftp/templates/link.sh
Copy the following into link.sh using nano:
#!/bin/bash if grep --quiet '<meta name="generator" content="NSB/AppStudio 3.*" />' /srv/ftp/home/$1/index.html; then ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1 fi # add elif lines for more templates rm /srv/ftp/AS_UPLOAD_COMPLETED/$1
Save the file using Ctrl-O and mark it executable:
sudo chmod a+x /srv/ftp/templates/link.sh
Next you need to configure incron for ftpuser. First allow ftpuser to use incron by creating the following file:
sudo nano /etc/incron.allow
Add the following content to the file and save with Ctrl-O:
ftpuser
Edit ftpuser's incrontab:
sudo incrontab -u ftpuser -e
This brings up an editor. Paste the following content into the editor:
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# > /dev/null 2>&1
Save the content with Ctrl-O. Incron should now be configured. You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder's name. The file you created should be removed and the folder should contain a link to your template.
Uploading & Verification
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio's protocol, described below.
AppStudio Upload Protocol
AppStudio uploads projects to a test server with the following steps:
- Choose a unique prefix for the folder based on the user's registration.
- Connect via FTP and upload the prefixed project folder into the ftp home folder.
- Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.
You can follow these steps manually to test the system.
Verification
If the system is working properly, a symbolic link to the template should have appeared in your project's folder after uploadng. Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.