Instalace Ubuntu internet server


Změna hostname serveru

nano /etc/hostname a /etc/hosts file

Instalace ssh

sudo apt-get install ssh

Změna ip adresy z dhcp na statickou

sudo nano /etc/network/interfaces

auto eth0
iface eth0 inet dhcp

na

auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

sudo vi /etc/resolv.conf

nameserver 192.168.1.1

sudo apt-get remove dhcp-client

sudo /etc/init.d/networking restart

Instalace, list a update packages

update a upgrade:

sudo apt-get update && apt-get upgrade

zobrazení .deb souborů které budou instalovány:
dpkg-query -L <package_name>
dpkg-query -c <package_name.deb>
instalace balíků:
sudo apt-get install apt-file
sudo apt-file update
apt-file list <package_name>

odinstalace a oprava závislostí:
sudo apt-get remove apt-file
apt-get -f install
sudo apt-get autoremove

sudo apt-get clean
Instalace balíků databáze, webserveru a PHP

apt-get install mysql-server
apt-get install apache2
apt-get install php5
apt-get install phpmyadmin

Nastavení Apache, website a moduly
a2ensite /etc/apache2/sites-available/site.conf
a2enmod rewrite 
a2enmod cgi 
a2enmod ssl 
service apache2 restart
Nastavení ssl na apache: 
a2ensite default-ssl 
mkdir /etc/apache2/ssl 
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt 
nano /etc/apache2/sites-available/default-ssl 
SSLCertificateFile /etc/apache2/ssl/apache.crt 
SSLCertificateKeyFile /etc/apache2/ssl/apache.key 

nano /etc/phpmyadmin/apache.conf (přidat) 
<IfModule mod_rewrite.c>   
<IfModule mod_ssl.c>   
<Location /phpmyadmin>   
RewriteEngine on   
RewriteCond %{HTTPS} !^on$ [NC]   
RewriteRule . https://%{HTTP_HOST}:443%{REQUEST_URI} [L]   
</Location>   
</IfModule>  
</IfModule>  

Instalace utitilit:
apt-get install awstats
apt-get install mutt
apt-get install wget
apt-get install phantomjs
apt-get install php-apc php5-memcache php-xml-parser
nano /etc/php5/apache2/php.ini 
expose_php = Off
apt-get install memcached
nano /etc/memcached.conf
-m 64

Konfigurace ufw
sudo ufw enable
ufw allow ftp # otevře port 21  ufw deny ftp # zavře port 21 
povolené porty 22(ssh),25(smtp),80(http),443(https),110(pop3)143(imap),465(smtps,ssl),993(imaps),995(pop3s)
,