Schulung-Teil3-Webserver aufsetzen: Unterschied zwischen den Versionen

Aus revampedia
Zeile 1: Zeile 1:
 +
{{#switch:{{#IfLang:}}
 +
|en=
 +
 +
This training took place on 11-17-2016 and it's the continuation of [http://wiki.revamp-it.ch/index.php?title=Schulung-Teil2-Server_mit_Xen_aufsetzen Teil2]. The first virtual machine is going to become a web server (Apache).  JR <br />
 +
 +
<pre>
 +
If there are still questions open after these instructions, please go to "Views" and then "Discussion" to leave your feedback, so I can add more Details to this page. jr
 +
</pre>
 +
 +
== Login to the virtual machine via SSH ==
 +
On the newly created virtual machine did we create a new username with password and installed sudo. Now we can login to the machine via SSH:
 +
 +
ssh user1@vm1
 +
 +
== Install packages for the web server ==
 +
Since we've just created the virtual machine the package list of apt is up to date. If some time has passed since the creation it would necessary to first enter the command "sudo apt update". <br />
 +
 +
sudo apt install apache2 apache2-bin apache2-utils apache2-doc
 +
 +
After the packages have been installed you can enter the IP address of the virtual machine in a browser. To find out your IP address enter the command "ip a" in your console.<br />
 +
 +
Now we have a web server running. <br />
 +
 +
At this point we had to cancel our training session as the hard drive of the LTSP server crashed.<br />
 +
 +
 +
== Infos ==
 +
 +
On 12-15-16 we had another training session with a different teacher. Unfortunately we lacked the time to to install something new to our server, but we've learned a few things.
 +
 +
With the following command you can find out the IP address of your server in an LTSP system.
 +
sudo arp
 +
The command also works on other devices where you have sudo rights. With [https://de.wikipedia.org/wiki/Address_Resolution_Protocol ARP] you can see your "neighbors" in an IPv4 network. It does '''not''' mean the neighbors in the house or appartement next door, but other devices in the same network. As we've written down the MAC address of our server we can determine the IP address of it.
 +
After we've managed to get back on our virtual machines we've learned two new ways to check if the web server is running or not
 +
 +
=== Option 1 ===
 +
ps -ef | grep apache
 +
 +
The command "ps" shows us active processes on a computer. The parameters "-e" and "-f" (combined to -ef) tell the system that we wish to see all processes and that we wish to see more details. With the pipe symbol (|) we take the output of the command and hand it over to the command "grep". With "grep" we can filter the result. We only want to see processes that contain "apache" and not the whole list.
 +
 +
=== Option 2 ===
 +
 +
sudo systemctl status apache2
 +
 +
The command "systemctl" is part of [https://freedesktop.org/wiki/Software/systemd/ systemd]. For a beginner this is probably too advanced to go into detail. I myself can only say that I know it exists and our first teacher isn't a big fan of it from what he told me so far.
 +
 +
=== Option 3 ===
 +
 +
This option we've already used on 11-17-16. We entered the IP address of our VM in the browser and checked if we get the test page.
 +
 +
== Management of web sites ==
 +
 +
On the test page is written that we can find the page at the following place on our system:
 +
/var/www/html/index.html
 +
 +
on our virtual machine with the web server we go to the following directory:
 +
cd /var/www/html/
 +
To look at the content of the file we use the program "less"
 +
less index.html
 +
The file contains the HTML code and the text of the web site. As we're not planing on learning HTML we leave it at that. <br />
 +
<br />
 +
If you've read [http://wiki.revamp-it.ch/index.php?title=CLI-Teil1-Einf%C3%BChrung_ins_Command_Line_Interface CLI-Teil1] and the in section of Filesystem Hierarchy (Verzeichnisstruktur if I haven't translated the page yet) you can expand the text, that you can see that in /etc/ are configuration files. So, to change the displayed web site you need to go into the sub-directory of Apache in /etc/.
 +
cd /etc/apache2/
 +
To see all the content of the directory you need to use the command ls with the parameters -l (more details) und -a (show everything, even hidden files)
 +
ls -la
 +
<br />
 +
Here we have several directories that begin the same but have differnt endings. The two possible endings are -available and -enabled. To manage a web site you work in the directory sites-available and you create a link to sites-enabled. So, to enable or disable a web site you create a link or remove it.
 +
<br />
 +
Here's where the training on 12-16-16 ended. At another point we'll probably learn more about web servers and how to set up kivitendo. <br />
 +
 +
 +
|#default=
 
Diese Schulung hat am 17.11.2016 stattgefunden und ist eine Weiterführung von [http://wiki.revamp-it.ch/index.php?title=Schulung-Teil2-Server_mit_Xen_aufsetzen Teil2]. Die erste virtuelle Maschine wird ein Webserver (Apache) werden. Doch ist aktuell noch nicht fertig, da es Probleme auf unserem Schulungsserver gab. JR <br />
 
Diese Schulung hat am 17.11.2016 stattgefunden und ist eine Weiterführung von [http://wiki.revamp-it.ch/index.php?title=Schulung-Teil2-Server_mit_Xen_aufsetzen Teil2]. Die erste virtuelle Maschine wird ein Webserver (Apache) werden. Doch ist aktuell noch nicht fertig, da es Probleme auf unserem Schulungsserver gab. JR <br />
  
Zeile 67: Zeile 139:
 
  <br />
 
  <br />
 
Hier hat die Schulung vom 16.12.16 ihr Ende gefunden. Wohl mehr Infos zum Webserver und wie man Kividendo aufsetzt werden später mal folgen. <br />
 
Hier hat die Schulung vom 16.12.16 ihr Ende gefunden. Wohl mehr Infos zum Webserver und wie man Kividendo aufsetzt werden später mal folgen. <br />
 +
}}
  
 
[[Kategorie:Schulungen_/_Workshops]]
 
[[Kategorie:Schulungen_/_Workshops]]

Version vom 4. April 2017, 11:58 Uhr

Diese Schulung hat am 17.11.2016 stattgefunden und ist eine Weiterführung von Teil2. Die erste virtuelle Maschine wird ein Webserver (Apache) werden. Doch ist aktuell noch nicht fertig, da es Probleme auf unserem Schulungsserver gab. JR

Falls noch Fragen offen sind nach dieser Anleitung bitte oben bei "Ansichten" auf "Diskussion" gehen und Feedback hinterlassen, dass ich noch weitere Details hinzufügen kann. jr

Auf der virtuellen Maschine über SSH einloggen

Auf unserer neu erstellten virtuellen Maschine haben wir ja vorher noch einen Benutzernamen und Passwort erstellt und sudo installiert. Jetzt dürfen wir also über ssh auf die Maschine einloggen

ssh user1@vm1

Pakete für Webserver installieren

Da wir die Maschine erst gerade erstellt haben ist die Paketliste von apt aktuell. Falls einige Zeit seit dem Erstellen vergangen ist macht man am besten noch zuerst ein "sudo apt update".

sudo apt install apache2 apache2-bin apache2-utils apache2-doc

Nachdem diese Pakete installiert wurden darf man im Browser die IP Adresse von der virtuellen Maschine eingeben.

Und jetzt haben wir einen Webserver am laufen.

Zu diesem Zeitpunkt wurde unsere Schulung unfreiwillig abgebrochen, weil die Festplatte vom LTSP-Server in unserem Schulungsraum kaputt ging.
Ich nehme an, dass hier noch mehr dazu folgen wird, doch das konnten wir leider nicht mehr weiterführen.

Informatives

Am 15.12.16 hat eine weitere Schulung stattgefunden mit einem anderen Lehrer stattgefunden. Leider hat die Zeit gefehlt was neues zu installieren. Wir haben ein paar Dinge jedoch gelernt.

Mit dem folgenden Befehl lässt sich die IP von unseren Servern auf dem LTSP Server ermitteln.

sudo arp 

Der Befehl funktioniert auch auf anderen Geräten wo man sudo Rechte hat. Mit ARP kann man "Nachbarn" im IPv4-Netzwerk sehen. Damit sind nicht die Nachbarn im anderen Haus oder der anderen Wohnung gemeint, sondern die anderen Computer die sich im gleichen Netzwerk befinden. Da wir uns die MAC-Adresse von unseren Servern abgeschrieben haben können wir auch so die IP Adresse ermitteln.

Nachdem wir es wieder auf unsere virtuellen Maschinen geschafft haben konnten wir über die folgenden Möglichkeiten prüfen ob unser Webserver läuft oder nicht

Variante 1

ps -ef