Pre-Requirements:
- Micrososft Azure account
- SSH client putty
Step 2: Select virtual machine option and click “create a virtual machine”
Step 3: There are two options to create a Ubuntu virtual machine. One is quick create, using which you quickly create a new Ubuntu virtual machine. Second one is creating virtual machine form gallery. If you have pre-configured image of any Ubuntu virtual machine, it will be present inside the gallery. I am going to use the quick create option since i do not have any pre-configures images in my gallery.
Step 4: Select the quick create option and enter the necessary credentials. First you have to enter the DNS name which will be followed by .cloudapp.net extension. I am going to give comtechies.cloudapp.net. You can choose your own domain name. Secondly select the ubuntu 12.04 image from the given set of images and select the size for your virtual machine. If you are using the trial account you should select the small size. By default the username is “azureuser”. You have to create password for the azureuser. There are six regions available, you can choose any region. Better is to choose the region nearby your country. Once you finish entering the details click “create a virtual machine”.
It will take some time for the virtual machine creation. You can check the status to know if the virtual machine is created or not. Status will be “running” once virtual machine is created.
Step 5: Ubuntu server does not have a GUI, so we have to connect the Ubuntu instance using SSH client putty. Click on the virtual machine and go to the dashboard of the virtual machine to get the public ip and ssh port of the virtual machine. In the dashboard window , just scroll down a little to get the public ip and ssh port number.
Step 6: Connect the Ubuntu instance using putty. Open putty and it the host section give the public ip and in the port , give the port number, which can be obtained from ssh details in the dashboard as shown in the figure above. After entering the necessary details, click open.
Step 7: Enter the username as “azureuser” and the password you created at the time of virtual machine creation. Once logged in to the server, you have to update the server using the following command.
sudo apt-get update
Ubuntu will ask password each time when you try to install anything, So you have to add the user to the suoders file.Use the following commands to that.
sudo su
visudo
Add the Following code to the sudoers file as shown in the figure below. Save the file after adding the code.
azureuser ALL=(ALL:ALL) ALL
Step 7:In-order to access your website through browser , you have to add the http endpoint to the Ubuntu instance. To do that, go to virtual machine dashboard menu and select endpoint. Click “add endpoint” and give the public and private port as 80. You can give any name for the endpoint.
Apache tomcat by default listens to port 8080, so you have to add an endpoint for Apache7 with private and public port as 8080
Step 7: Install Apache Tomcat7 using the following command.
sudo apt-get install tomcat7
Now check if the tomcat server is installed properly. To do this enter the public ip followed by the 8080 port number. eg: http://168.83.162.170:8080/ and press enter. If the web page loads and shows a message “It works”, then your Apache server has been configured properly.
Step 8: Install Apache manager using the following command.
sudo apt-get install tomcat7-admin
Step 9: Manager permissions will be restricted by default. So you have to change the user and role in the tomcat-users.xml file. Use the following codes to do that.
cd /etc/tomcat7
sudo nano tomcat-users.xml
Uncomment the tomcat-users section and add the following code.