Quick Ubuntu 18 Administration
Quick Ubuntu 18 Administration
######################################################################
Q1.Setup IP Configuration on server1
######################################################################
IP Configuration
Hostname: server1.example.com
IP address: 192.168.122.10
Netmask: 255.255.255.0
Gateway: 192.168.122.1
Name Server: 192.168.122.1
######################################################################
ip a | grep ens3
######################################################################
Q2. Install LAMP(Apache,MySQL & PHP) server
#####################################################################
vim /var/www/html/phpinfo.php
<?php
phpinfo();
?>
cat /var/www/html/phpinfo.php
http://192.168.122.10/phpinfo.php
mysql_secure_installation
ServerName 192.168.122.10
apache2ctl configtest
tail -f /var/log/apache2/access.log
tail -f /var/log/apache2/error.log
journalctl -p err _SYSTEMD_UNIT=apache2.service
######################################################################
Q3. Install phpMyAdmin on server
#####################################################################
Restart apache2
systemctl restart apache2
http://192.168.122.10/phpmyadmin
phpmyadmin
XXXXXXX
######################################################################
Q4. Install and configure ntp on server
#####################################################################
Configure Firewall
ufw allow from any to any port 123 proto udp
######################################################################
Q5. Install and configure nfs server on server
###############################################################
Install required Packages
apt install nfs-kernel-server -y
cat /proc/fs/nfsd/versions
/home *.example.com(rw,sync,no_subtree_check)
/homes 192.168.122.0/24(rw,sync,no_root_squash,no_subtree_check)
/mnt/datastore/datacenter 192.168.122.0/24(rw,sync,no_root_squash,no_subtree_check)
exportfs -rv
Configure Firewall
ufw enable
ufw status
vim /etc/fstab
mount -a
df -hT
######################################################################
Q6. Install and configure JAVA 8 on server
############################################################
Install required Packages
apt update
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
java -version
######################################################################
Q7. Install and configure Apache Maven on server
###########################################################
Download Apache Maven source
cd /opt/
wget https://downloads.apache.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
Extract archive
tar xvf apache-maven-3.3.9-bin.tar.gz
vim maven.sh
# Apache Maven Environment Variables
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export MAVEN_HOME=/opt/apache-maven
export PATH=${MAVEN_HOME}/bin:${PATH}
######################################################################
Q8. Install and configure git on server
############################################################
Install required packages
apt update
Setup git
git config --global user.name "Andrey Jozef"
cat ~/.gitconfig
[user]
email = [email protected]
######################################################################
Q9. Install and configure jenkins on server
############################################################
ufw enable
ufw status
Setup jenkins
http://192.168.10.111:8080
cat /var/lib/jenkins/secrets/initialAdminPassword
admin
###################################################
#############################################################
Q10. Install docker on server
#############################################################
Update software list
apt update
Configure postfix
vim /etc/postfix/main.cf
inet_interfaces = loopback-only
myhostname=mail.example.com
OR
postconf -e 'myhostname=mail.example.com’
su -l student
###################################################
cd nagioscore-nagios-4.4.5/
Compile and install Nagios
./configure --with-httpd-conf=/etc/apache2/sites-enabled
make all
id nagios
Setup firewall
ufw enable
ufw reload
ufw status
Extract archive
./tools/setup
./configure
Update contacts.cfg
vim /usr/local/nagios/etc/objects/contacts.cfg
Update commands.cfg
vim /usr/local/nagios/etc/objects/commands.cfg
define command{
command_name check_nrpe
http://192.168.122.10/nagios/
Update nrpe.cfg
cd /etc/nagios/
vim nrpe.cfg
server_address=192.168.10.11
allowed_hosts=127.0.0.1,::1,192.168.122.10
Update nrpe_local.cfg
command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_ping]=/usr/lib/nagios/plugins/check_ping -H 192.168.122.11 -w
100.0,20% -c 500.0,60% -p 5
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh -4 192.168.122.11
command[check_http]=/usr/lib/nagios/plugins/check_http -I 192.168.122.11
command[check_apt]=/usr/lib/nagios/plugins/check_apt
/usr/lib/nagios/plugins/check_nrpe -H 192.168.122.11
/usr/lib/nagios/plugins/check_nrpe -H 192.168.122.11 -c check_ping
host_name client01
address 192.168.122.11
register 1
define service {
host_name client01
service_description PING
check_command check_nrpe!check_ping
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
define service {
host_name client01
check_command check_nrpe!check_users
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
define service {
host_name client01
check_command check_nrpe!check_ssh
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
define service {
host_name client01
check_command check_nrpe!check_root
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
define service {
host_name client01
check_command check_nrpe!check_apt
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
define service {
host_name client01
check_command check_nrpe!check_http
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
Check Nagios config might have typos
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
###################################################
Update apache2.conf
cd /etc/apache2
ls -l
vim apache2.conf
ServerName 192.168.122.50
Login to MySQL
mysql -u root -p
Reload Privileges
FLUSH PRIVILEGES;
Configure Wordpress
cd /var/www/wordpress
mv wp-config-sample.php wp-config.php
vim wp-config.php
define( 'DB_NAME', 'wordpress' );
ls -l
vim wordpress.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wordpress
ServerAlias server5.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DirectoryIndex index.html index.php
DocumentRoot /var/www/wordpress
<Directory /var/www/worpress>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart apache2
systemctl restart apache2
Install wordpress
Open Firefox
http://192.168.122.50