Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vms:webdev:start [2014/10/30 13:38]
admin [Create a Debian VM]
vms:webdev:start [2015/04/03 18:51] (current)
66.249.64.157 Links adapted because of a move operation
Line 1: Line 1:
-====== Web Development ======+====== Web Development ​(LAMP) ​======
 The purpose here is to build a virtual machine that will be used as a LAMP web development environment. The purpose here is to build a virtual machine that will be used as a LAMP web development environment.
  
Line 11: Line 11:
 Install a Debian Wheezy system from Debian'​s stable netboot-mini.iso image. Install a Debian Wheezy system from Debian'​s stable netboot-mini.iso image.
  
-You can refer to [[vms:webdev:​debian|this section of the wiki]] for more in-depth information on how to do this.+You can refer to [[vms:​debian|this section of the wiki]] for more in-depth information on how to do this.
  
 We'll have 2 adapters set up for this VM, one for local communication on a 172.20.20.x address and another one for internet access via DHCP. We'll have 2 adapters set up for this VM, one for local communication on a 172.20.20.x address and another one for internet access via DHCP.
Line 18: Line 18:
  
  
-==== Add sysadmin to sudoers ==== 
----- 
  
-After the system reboots at the end of the installation, login as root and install ​the sudo package:+ 
 +==== Setup Network Adapters ==== 
 + 
 +In our setup, we'll allocate ​the IP address 172.20.20.2 as our local access address, you could of course choose whatever fits your personal configuration requirements.\\ 
 +On the first launch of our VM, an arbitrary DHCP address will be allocated to it's first interface, to find out its address, login to the VM using the regular VirtualBox window and type:
 <​code>​ <​code>​
-# apt-get install sudo+> ip addr show 
 +1: lo: <​LOOPBACK,​UP,​LOWER_UP>​ mtu 16436 qdisc noqueue state UNKNOWN  
 +    link/​loopback 00:​00:​00:​00:​00:​00 brd 00:​00:​00:​00:​00:​00 
 +    inet 127.0.0.1/8 scope host lo 
 +    inet6 ::1/128 scope host  
 +       ​valid_lft forever preferred_lft forever 
 +2: eth0: <​BROADCAST,​MULTICAST,​UP,​LOWER_UP>​ mtu 1500 qdisc pfifo_fast state UP qlen 1000 
 +    link/ether 08:​00:​27:​55:​21:​b7 brd ff:​ff:​ff:​ff:​ff:​ff 
 +    inet 10.0.7.61/​24 brd 10.0.7.255 scope global eth0 
 +    inet6 fe80::​a00:​27ff:​fe55:​21b7/​64 scope link  
 +       ​valid_lft forever preferred_lft forever 
 +3: eth1: <​BROADCAST,​MULTICAST>​ mtu 1500 qdisc noop state DOWN qlen 1000 
 +    link/ether 08:​00:​27:​6e:​8b:​7d brd ff:​ff:​ff:​ff:​ff:​ff
 </​code>​ </​code>​
  
-As the sysadmin user was created during the Debian install process we only need to add it to the sudoers group:+This will indicate ​the allocated DHCP address for your VM, here 10.0.7.61. 
 + 
 +From there you might want to use a terminal emulator to access the VM as it will usually be easier ​to use than the standard VM screen that has no scroll back or copy/paste functionality for example. 
 + 
 +Let's now fix the secondary (local) IP address. To this purpose, let's modify the // /​etc/​network/​interfaces // file to make it look like what follows:
 <​code>​ <​code>​
-usermod ​-G sudo -a <​sysadmin>​+> nano /​etc/​network/​interfaces 
 + 
 +This file describes the network interfaces available on your system 
 +# and how to activate them. For more information,​ see interfaces(5). 
 + 
 +# The loopback network interface 
 +auto lo 
 +iface lo inet loopback 
 + 
 +# The primary network interface 
 +allow-hotplug eth0 
 +iface eth0 inet dhcp 
 + 
 +# Alias for static inner interface 
 +auto eth1 
 +iface eth1 inet static 
 +   name static alias LAN card 
 +   ​address 172.20.20.2 
 +   ​netmask 255.255.255.0 
 +   ​broadcast 172.20.20.255 
 +   ​network 172.20.20.0
 </​code>​ </​code>​
  
-Logout from the root sessionlogin as sysadmin and test your sudo power:+We only still need to restart ​the secondary interface to activate the newly set fixed IP addressthen check that is correctly set: 
 <​code>​ <​code>​
-# exit +> ifdown eth1 && ifup eth1 
-loginsysadmin +ifdowninterface eth1 not configured 
-Password+ 
-$ sudo ifconfig+> ip addr show 
 +1: lo: <​LOOPBACK,​UP,​LOWER_UP>​ mtu 16436 qdisc noqueue state UNKNOWN  
 +    link/​loopback 00:​00:​00:​00:​00:​00 brd 00:​00:​00:​00:​00:​00 
 +    inet 127.0.0.1/8 scope host lo 
 +    inet6 ::1/128 scope host  
 +       ​valid_lft forever preferred_lft forever 
 +2: eth0: <​BROADCAST,​MULTICAST,​UP,​LOWER_UP>​ mtu 1500 qdisc pfifo_fast state UP qlen 1000 
 +    link/ether 08:​00:​27:​55:​21:​b7 brd ff:​ff:​ff:​ff:​ff:​ff 
 +    inet 10.0.7.61/​24 brd 10.0.7.255 scope global eth0 
 +    inet6 fe80::​a00:​27ff:​fe55:​21b7/​64 scope link  
 +       ​valid_lft forever preferred_lft forever 
 +3: eth1: <​BROADCAST,​MULTICAST,​UP,​LOWER_UP>​ mtu 1500 qdisc pfifo_fast state UP qlen 1000 
 +    link/ether 08:​00:​27:​6e:​8b:​7d brd ff:​ff:​ff:​ff:​ff:​ff 
 +    inet 172.20.20.2/​24 brd 172.20.20.255 scope global eth1 
 +    inet6 fe80::​a00:​27ff:​fe6e:8b7d/64 scope link  
 +       valid_lft forever preferred_lft forever
 </​code>​ </​code>​
  
-If all is well, you should see the output from the ifconfig command.+The last block (3: eth1:) indicates that our secondary interface ​is well set with the targeted fixed IP address 172.20.20.2 
 + 
 +We're ready to move on... 
 ----- -----
 +==== Change VM's Hostname ====
  
 +To make things clear, and have an indication of the machine we're logged to whenever we ssh into it, we'll change the machine'​s hostname. This is done by editing 2 more file: // /etc/hosts // and // /​etc/​hostname //:
 +
 +In /etc/hosts, you'll only need to change the second line to make it look like the following:
 +<​code>​
 +> nano /etc/hosts
 +
 +127.0.0.1 ​      ​localhost
 +127.0.1.1 ​      ​lamp-xd.virtual.net ​    ​lamp-xd
 +
 +# The following lines are desirable for IPv6 capable hosts
 +::1     ​localhost ip6-localhost ip6-loopback
 +ff02::1 ip6-allnodes
 +ff02::2 ip6-allrouters
 +</​code>​
 +
 +Then replace the content of /​etc/​hostname ​
 +<​code>​
 +> nano /​etc/​hostname
 +
 +lamp-xd
 +</​code>​
 +
 +You'll need to restart the VM for those changes to take effect
 +<​code>​
 +> reboot
 +</​code>​
 +-----
 It is now time to [[apache|install the HTTP Server (Apache2)]]. It is now time to [[apache|install the HTTP Server (Apache2)]].