This is part 2 of Building LAMP on Ubuntu. This sections covers the initial setup of the server following the Ubuntu OS install covered in Installing Ubuntu Operating System
Set Root Password
At this point in the installation the root password is blank, and therefore there is no way to log in as root. Although most administrative tasks can be performed using the sudo command, it makes things easier to have the ability to become root.
Log in to the console using the user account created in part one and type the following command and press Enter:
sudo passwd root
You will first be prompted to enter your current user password (the one you just logged in with). Next you will be asked to enter a new password for the root account, and type it again to confirm. When complete you should see a message indicating that the root password was successfully updated.
To become root, type the su command and press enter:
Enter the root password you just created and press enter
Configure Static IP Address
During the installation in part one, the system automatically configured the IP address of the server using DHCP. However, since this will be a web server, it is a good idea to set a static IP address.
To see the current ip address type the following command and press enter:
Current network configuration is displayed. Notice the ip address set for your nic card (probably eth0)
The following shows how to edit the network interface configuration file using the vi editor. Make sure you are still logged in as root and enter the following:
The file will be opened by vi. Notice that the network card is set to dhcp and there is no address defined.
If you have never used vi before, be forewarned that it takes some getting used to. If you make a mistake, just remember the following sequence to escape and not save changes:
ESC :q! ENTER (press escape key, type colon, lowercase q and an exclamation mark, and press ENTER)
Use the arrow keys to move the cursor up/down/left/right. Position the cursor underneath the d of dhcp.
Press the x key four times to delete the word dhcp
Press the i key to start insert mode (when in insert mode you can insert text. to escape insert mode press ESC). You will know you are in insert mode because it says INSERT at the bottom of the screen.
Type the word static and press ENTER to go to the next line
Next enter address and the server’s static ip address, netmask and the subnet mask, and gateway and the server’s gateway/router
Once finished, press the ESC key to escape from insert mode and enter the following command to save and exit:
:x! (colon, lowercase x, and an exclamation mark)
Changes are saved
We will follow the same procedure to edit DNS. Enter the following command to open the dns configuration file:
Edit the IP address following nameserver to your primary DNS server, and optionally add a second nameserver line with your secondary name server
Enter the following command for the networking changes to take effect
Verify that your changes took effect by once again typing ipconfig -a
You should see your new ip address for the primary network card
After you complete the setup, you should also review part 3:
If you have questions or problems with this build doc please leave a comment below.
|Print This Post|