Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wie installiert man LAMP auf Ubuntu 16.04
#1
Information 
Wie installiert man LAMP auf Ubuntu 16.04


Step 1: Installiert Apache und gebt den Port in der Firewall frei
Der Apache Webserver ist einer der Bekanntesten welweit.

Code:
sudo apt-get update
sudo apt-get install apache2


Step 2: Setzt einen globalen Servernamen um Syntax Warnungen zu vermeiden.


[b]Als Nächsten werden wir eine einzelne Zeile einfügen um eine Warnmeldung zu unterdrücken. 

[/b]
Code:
/etc/apache2/apache2.conf


Code:
sudo apache2ctl configtest


Code:
Output
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK


Öffnet die Hauptkonfigurationsdatei mit einem beliebigen Text Editor:


Code:
sudo nano /etc/apache2/apache2.conf


Am Ende der Datei, fügt eine Weiterleitung zu eurer Domain hinzu, falls ihr keine habt, könnt ihr auch eure Server IP-Adresse eintragen:

Step 3: Passt die Firewall an, um die Anfragen des Webservers durchzulassen.


Code:
sudo ufw app list


Code:
Output
Available applications:
 Apache
 Apache Full
 Apache Secure
 OpenSSH

Wenn man sich jetzt das Apache Profil ansieht, sollte man sehen, dass Port 80 and 443 freigegeben sind:


Code:
sudo ufw app info "Apache Full"

Code:
Output
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.

Ports:
 80,443/tcp

Erlaubt den Traffic für die Ports
Code:
sudo ufw allow in "Apache Full"

Step 4: Installiert Mysql:
Code:
sudo apt-get install mysql-server
Code:
mysql_secure_installation

Step 5: Installiert PHP:

Code:
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Code:
sudo nano /etc/apache2/mods-enabled/dir.conf

Es sollte so aussehen:

/etc/apache2/mods-enabled/dir.conf

Code:
<IfModule mod_dir.c>
   DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

Wir möchten die oben markierte PHP-Indexdatei an die erste Stelle nach der Verzeichnisindexangabe verschieben:

/etc/apache2/mods-enabled/dir.conf

Code:
<IfModule mod_dir.c>
   DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>


Code:
sudo systemctl restart apache2

Code:
sudo systemctl status apache2


Code:
Sample Output
● apache2.service - LSB: Apache2 web server
  Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
 Drop-In: /lib/systemd/system/apache2.service.d
          └─apache2-systemd.conf
  Active: active (running) since Wed 2019-03-13 14:28:43 EDT; 45s ago
    Docs: man:systemd-sysv-generator(8)
 Process: 13581 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
 Process: 13605 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   Tasks: 6 (limit: 512)
  CGroup: /system.slice/apache2.service
          ├─13623 /usr/sbin/apache2 -k start
          ├─13626 /usr/sbin/apache2 -k start
          ├─13627 /usr/sbin/apache2 -k start
          ├─13628 /usr/sbin/apache2 -k start
          ├─13629 /usr/sbin/apache2 -k start
          └─13630 /usr/sbin/apache2 -k start

Mar 13 14:28:42 ubuntu-16-lamp systemd[1]: Stopped LSB: Apache2 web server.
Mar 13 14:28:42 ubuntu-16-lamp systemd[1]: Starting LSB: Apache2 web server...
Mar 13 14:28:42 ubuntu-16-lamp apache2[13605]:  * Starting Apache httpd web server apache2
Mar 13 14:28:42 ubuntu-16-lamp apache2[13605]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerNam
Mar 13 14:28:43 ubuntu-16-lamp apache2[13605]:  *
Mar 13 14:28:43 ubuntu-16-lamp systemd[1]: Started LSB: Apache2 web server.


Installiert PHP Module:

Code:
apt-cache search php- | less

Code:
ibnet-libidn-perl - Perl bindings for GNU Libidn
php-all-dev - package depending on all supported PHP development packages
php-cgi - server-side, HTML-embedded scripting language (CGI binary) (default)
php-cli - command-line interpreter for the PHP scripting language (default)
php-common - Common files for PHP packages
php-curl - CURL module for PHP [default]
php-dev - Files for PHP module development (default)
php-gd - GD module for PHP [default]
php-gmp - GMP module for PHP [default]

:

Code:
apt-cache show package_name

Code:
apt-cache show php-cli

Code:
Output

Description-en: command-line interpreter for the PHP scripting language (default)
This package provides the /usr/bin/php command interpreter, useful for
testing PHP scripts from a shell or performing general shell scripting tasks.
.
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
open source general-purpose scripting language that is especially suited
for web development and can be embedded into HTML.
.
This package is a dependency package, which depends on Debian's default
PHP version (currently 7.0).


Code:
sudo apt-get install php-cli

Code:
sudo apt-get install package1 package2 ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)