Why?


Search This Blog

Sunday, July 31, 2016

Centos 7 setup PXE kickstart dhcpd tftpd httpd Server

Centos 7 setup PXE kickstart dhcpd tftpd httpd Server

First install Centos 7 minimal install CentOS-7-x86_64-Minimal-1511.iso.

I am using IP=10.10.10.20/24 gateway=10.10.10.254 DNS=192.168.10.10 for my server setup.

Disable selinux.

vi /etc/sysconfig/selinux

selinux=disabled


reboot

Login.

systemctl disable firewalld
systemctl stop firewalld

yum -y update

reboot


Login.

Create text file of /root/list with package list below in it.
Do not include the --begin list or the --end list lines in the file.

vi /root/list

--begin list   
bind-utils
traceroute
net-tools
ntp*
gcc
glibc
glibc-common
gd
gd-devel
make
net-snmp
openssl-devel
xinetd
unzip
libtool*
make
patch
perl
bison
flex-devel
gcc-c++
ncurses-devel
flex
libtermcap-devel
autoconf*
automake*
autoconf
libxml2-devel
cmake
sqlite*
wget
ntp*
lm_sensors
ncurses-devel
qt-devel
hmaccalc
zlib-devel
binutils-devel
elfutils-libelf-devel
wget
bc
gzip
uuid*
libuuid-devel
jansson*
libxml2*
sqlite*
openssl*
lsof
NetworkManager-tui
mlocate
yum-utils
kernel-devel
nfs-utils
tcpdump

--end list

yum -y install $(cat /root/list)

yum -y groupinstall "Development Tools"

yum -y update

reboot


Login.

Install reguired packes for PXE kickstart dhcpd tftpd httpd Server.

yum -y install dhcp tftp-server tftp syslinux httpd

Create your dhcpd.conf file.
Im using 10.10.10.20/24 for my PXE kickstart dhcpd tftpd httpd server.
Do not include the ---copy txt below or the ---end copy txt below lines in the file.

vi /etc/dhcp/dhcpd.conf

---copy txt below
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server 10.10.10.20;
filename "/pxelinux.0";

# specify domain name
option domain-name "whittenberg.domain";

# specify name server's hostname or IP address
option domain-name-servers 192.168.10.1;

# default lease time
default-lease-time 600;

# max lease time
max-lease-time 7200;

# this DHCP server to be declared valid
authoritative;

# specify network address and subnet mask
subnet 10.10.10.0 netmask 255.255.255.0 {
    # specify the range of lease IP address

    range dynamic-bootp 10.10.10.100 10.10.10.200;
    # specify broadcast address

    option broadcast-address 10.10.10.255;
    # specify default gateway

    option routers 10.10.10.254;
}

---end copy txt below

Start the service and check status.

systemctl enable dhcpd
systemctl start dhcpd
systemctl status dhcpd



You should now be able to PXE boot a machine and get an IP for this.
Just an IP though. Now we have to set it up to boot and install the ISO.

Setup PXE Server tftp-server.

mkdir -p /tftpboot
chmod 777 /tftpboot


vi /etc/xinetd.d/tftp and change to

server_args             = -s /tftpboot
disable                 = no


Start your tftp-server and check status.

systemctl enable xinetd.service
systemctl start xinetd.service
systemctl status xinetd.service


Copy syslinux files to tftp-server root directory of /tftpboot.

cp -v /usr/share/syslinux/pxelinux.0 /tftpboot
cp -v /usr/share/syslinux/menu.c32 /tftpboot
cp -v /usr/share/syslinux/memdisk /tftpboot
cp -v /usr/share/syslinux/mboot.c32 /tftpboot
cp -v /usr/share/syslinux/chain.c32 /tftpboot


Verify files are there.

ls -lsa /tftpboot

Start and check your httpd service.

systemctl enable httpd
systemctl start httpd
systemctl status httpd


FTP the Centos 7 CentOS-7-x86_64-Minimal-1511.iso to /root

mkdir /var/www/html/CentOS-7-x86_64-Minimal-1511

mount /root/CentOS-7-x86_64-Minimal-1511.iso /var/www/html/CentOS-7-x86_64-Minimal-1511


Verify files are there.

ls -lsa /var/www/html/CentOS-7-x86_64-Minimal-1511

Make netboot directory and place boot files in it.

mkdir -p /tftpboot/netboot/
cp /var/www/html/CentOS-7-x86_64-Minimal-1511/images/pxeboot/vmlinuz /tftpboot/netboot/
cp /var/www/html/CentOS-7-x86_64-Minimal-1511/images/pxeboot/initrd.img /tftpboot/netboot/


Verify files are there.

ls -lsa /tftpboot/netboot/

Now create the kickstart cfg file in the /var/www/html/ directory.

vi /var/www/html/ks.cfg

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
url --url="http://10.10.10.20/CentOS-7-x86_64-Minimal-1511/"
# Root password [i used here 000000]
rootpw 000000
# Reboot after installation
reboot
# System authorization information
auth  useshadow  passalgo=sha512
# Use graphical install
graphical
firstboot disabled
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux disabled
# Installation logging level
logging level=info
# System timezone
timezone America/Phoenix
# System bootloader configuration
bootloader location=mbr
clearpart --all --initlabel
part swap --asprimary --fstype="swap" --size=1024
part /boot --fstype xfs --size=200
part pv.01 --size=1 --grow
volgroup rootvg01 pv.01
logvol / --fstype xfs --name=lv01 --vgname=rootvg01 --size=1 --grow

%packages
@core
%end
%post
%end


Now create directory for our PXE menu and create menu.

mkdir /tftpboot/pxelinux.cfg

vi /tftpboot/pxelinux.cfg/default

default menu.c32
prompt 5
timeout 20
MENU TITLE CentOS-7-x86_64-Minimal-1511 PXE Menu

LABEL CentOS-7-x86_64-Minimal-1511
MENU LABEL CentOS-7-x86_64-Minimal-1511
KERNEL /netboot/vmlinuz
APPEND  initrd=/netboot/initrd.img  inst.repo=http://10.10.10.20/CentOS-7-x86_64-Minimal-1511/ ks=http://10.10.10.20/ks.cfg


I now reboot for grins :) and after backup remount the ISO.

mount /root/CentOS-7-x86_64-Minimal-1511.iso /var/www/html/CentOS-7-x86_64-Minimal-1511

Or add this to your  /etc/fstap file. Be sure and not leave any extra lines/spaces after the entry.

/root/CentOS-7-x86_64-Minimal-1511.iso /var/www/html/CentOS-7-x86_64-Minimal-1511 iso9660 loop,ro,auto 0 0

You can test your fstab file with.

mount -a

That's it. You can change hostname, password, and use static IP, add additonal packages, etc. after its rebooted.



Sunday, July 24, 2016

mediawiki-1.27.0 Install

mediawiki-1.27.0 Install



WORK IN PROGRESS

Base centos 7 with just yum updates run up to this point

---------install of php 5.6

For CentOS 7 (including EPEL install)
   
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm

If you already have EPEL installed:
   
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm

Enabling the Repo

Now we need to make sure the repo is enabled and select which version you want to install. We need to head over to /etc/yum.repos.d you should inside see a file called remi.repo.

Open the file in your favorite editor (Nano, Pico, Vi etc), you’ll see a number of sections. We need to make sure that the first section [remi] is enabled:

[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi


Note the line enabled=1 make sure this is set! Now technically you can actually go ahead and install PHP, but you will only get PHP 5.4.*. Which might be want to you want is so skip ahead to the next section!

If we want PHP 5.5 or PHP 5.6 we need to do a bit more work, further down in the repo.repo file you will see two additional sections [remi-php55] and [remi-php56], decide which PHP version you want to install and then enable the correct. So for PHP 5.6 we would change to:

[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi


Installing PHP

yum install php php-gd php-mysql php-mcrypt

So the above assumes you want MySQL, GD and Mcrypt support in your PHP, but you should see something like the below depending on which version of PHP you are trying to install:

================================================================================================================================
 Package                        Arch                   Version                                 Repository                  Size
================================================================================================================================
Installing:
 php                            x86_64                 5.5.20-2.el6.remi                       remi-php55                 2.6 M
 php-gd                         x86_64                 5.5.20-2.el6.remi                       remi-php55                  72 k
 php-mysqlnd                    x86_64                 5.5.20-2.el6.remi                       remi-php55                 3.6 M
Installing for dependencies:
 php-cli                        x86_64                 5.5.20-2.el6.remi                       remi-php55                 3.7 M
 php-common                     x86_64                 5.5.20-2.el6.remi                       remi-php55                 1.0 M
 php-pdo                        x86_64                 5.5.20-2.el6.remi                       remi-php55                 112 k
 php-pear                       noarch                 1:1.9.5-3.el6.remi                      remi                       375 k
 php-pecl-jsonc                 x86_64                 1.3.6-1.el6.remi.5.5.1                  remi-php55                  47 k
 php-pecl-zip                   x86_64                 1.12.4-1.el6.remi.5.5                   remi-php55                 269 k
 php-process                    x86_64                 5.5.20-2.el6.remi                       remi-php55                  57 k
 php-xml                        x86_64                 5.5.20-2.el6.remi                       remi-php55                 208 k

Transaction Summary
================================================================================================================================
Install      11 Package(s)

php -v to check version

As you can see PHP is installing version 5.5.20-2.el6.remi from the remi-php55 repo! Once you have hit Y to confirm the install restart apache and magical unicorns you have a better version of PHP!

You can also change your mind in the future by going back into the remi.repo file and enable a different PHP version and then run yum update and if you have moved from 5.5 to 5.6 it will upgrade PHP for you. If you want to downgrade for any reason you will need to remove PHP (sudo yum remove php*) and then reinstall the PHP modules you want.

---------end install of php 5.6

---------install need php extensions

yum install php-xml
yum install php-mbstring

---------end install need php extensions

---------install maridb and Apache

yum -y install httpd mariadb-server mariadb

systemctl enable httpd.service
systemctl start httpd.service
systemctl status httpd.service

systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb
mysql_secure_installation

Now test apache and php

vi /var/www/html/info.php
<?php phpinfo(); ?>

http://your_server_IP_address/info.php

---------end install maridb and Apache

**********need to add commands here*********

--------create database and db user for user


--------end create database and db user for user


---------Install mediawiki-1.27.0

donwload mediawiki-1.27.0 to pc
unzip to pc desktop
ftp tar fil over to /var/www/html
cd /var/www/html
tar -xvf ./mediawiki-1.27.0.tar

Now run the installer at (replace with your IP)

http://192.168.10.20/mediawiki-1.27.0/mw-config/index.php


---------end Install mediawiki-1.27.0

Friday, July 22, 2016

Centos 7 create vm template

Centos 7 create vm template

Using ESXi 6.0

First create a quest image then convert it to template.

I do a fresh min install using DHCP for interface and EFI for BIOS.

After OS is layed down i do the following.

Disable selinux

vi /etc/sysconfig/selinux
    selinux=diabled
   
reboot   

Disable and turn off firewalld
   
systemctl disable firewalld
systemctl stop firewalld

yum -y update

reboot

---begin if you want to use the old eth0 naming convention       
       
vi /etc/default/grub
            Search for the line “GRUB_CMDLINE_LINUX” and append the following: net.ifnames=0 biosdevname=0

you can also turn off the screensaver for your console by adding consoleblank=0

My line is now:

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos_nas/swap rd.lvm.lv=centos_nas/root net.ifnames=0 biosdevname=0 consoleblank=0"

grub2-mkconfig -o /boot/grub2/grub.cfg

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg   

mv /etc/sysconfig/network-scripts/ifcfg-enp????? /etc/sysconfig/network-scripts/ifcfg-eth0   

vi /etc/sysconfig/network-scripts/ifcfg-eth0
    NAME=eth0
    DEVICE=eth0

---end     if you want to use the old eth0 naming convention

---turn off NetworkManage     

systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl stop NetworkManager-wait-online
systemctl disable NetworkManager-wait-online
systemctl enable network
chkconfig network on
systemctl start network


reboot

do sanity check

systemctl status NetworkManager
systemctl status network

---end turn off NetworkManager

Create text file /root/list with packge list below in it
do not include the --begin list or the --end list lines in the file

--begin list   
bind-utils
traceroute
net-tools
ntp*
gcc
glibc
glibc-common
gd
gd-devel
make
net-snmp
openssl-devel
xinetd
unzip
libtool*
make
patch
perl
bison
flex-devel
gcc-c++
ncurses-devel
flex
libtermcap-devel
autoconf*
automake*
autoconf
libxml2-devel
cmake
sqlite*
wget
ntp*
lm_sensors
ncurses-devel
qt-devel
hmaccalc
zlib-devel
binutils-devel
elfutils-libelf-devel
wget
bc
gzip
uuid*
libuuid-devel
jansson*
libxml2*
sqlite*
openssl*
lsof
NetworkManager-tui
mlocate
yum-utils
kernel-devel
nfs-utils
tcpdump
--end list

yum -y install $(cat list)

yum -y groupinstall "Development Tools"

yum -y update

reboot

---tune 10Gb CNA if needed

service irqbalance stop
service cpuspeed stop
chkconfig irqbalance off
chkconfig cpuspeed off
systemctl disable irqbalance
systemctl disable cpuspeed

vi /etc/sysconfig/network-scripts/ifcfg-eth???
MTU="9000"

vi /etc/sysctl.conf
# -- tuning -- #
# Increase system file descriptor limit
fs.file-max = 65535

# Increase system IP port range to allow for more concurrent connections
net.ipv4.ip_local_port_range = 1024 65000

# -- 10gbe tuning from Intel ixgb driver README -- #

# turn off selective ACK and timestamps
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0

# memory allocation min/pressure/max.
# read buffer, write buffer, and buffer space
net.ipv4.tcp_rmem = 10000000 10000000 10000000
net.ipv4.tcp_wmem = 10000000 10000000 10000000
net.ipv4.tcp_mem = 10000000 10000000 10000000

net.core.rmem_max = 524287
net.core.wmem_max = 524287
net.core.rmem_default = 524287
net.core.wmem_default = 524287
net.core.optmem_max = 524287
net.core.netdev_max_backlog = 300000

reboot and test speed.

on linux client pointing to server with ip 192.168.90.100

# iperf3 -c 192.168.90.100 -p 5201

on linux server with IP 192.168.90.100

iperf3 -s -p 5201 -B 192.168.90.100

---end tune 10Gb CNA if needed


*********After the image is complete

poweroff

Go to vSphere client and right in image and conver to template

You can now right clik on template and create new image from template

After you create new image from template then

vi /etc/hostname
    make sure your hostname is in there. i use name.domain.com

vi /etc/hosts
    make sure your hotname is in there. I both name and name.domain.com
   
vi /etc/resolv.conf
        search yourdomain.com
        nameserver 192.168.10.1 or what ever you use for DNS
       

Edit your /etc/sysconfig/network-scripts/ifcfg-eth0 file
Remove DHCP and set for static

vi /etc/sysconfig/network-scripts/ifcfg-eth0

CentOS 7 rsyslog Server Setup

CentOS 7 rsyslog Server Setup

I have firewall off and selinux disabled

Install if needed

# yum -y install rsyslog
 
Edit the config file
 
# vi /etc/rsyslog.conf
 
Change to the following
 
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
 
# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514
 
Restart service
 
# systemctl restart rsyslog.service 

Now just point your devices to this server on port 514
Default location is /var/log for the files. This can be changed
in the rsyslog.conf file.

Saturday, July 16, 2016

Install KDE Plasma Desktop on CentOS 7

Install KDE Plasma Desktop on CentOS 7

# yum -y groups install "KDE Plasma Workspaces"

# startx

To start in graphic mode automaticly

# systemctl set-default graphical.target

check the setting

# systemctl get-default

Change back to non graphical multi user mode

# systemctl set-default multi-user.target

Other runlevel settings

Runlevel    Target Units                          Description
0           runlevel0.target, poweroff.target     Shut down and power off the system.
1           runlevel1.target, rescue.target       Set up a rescue shell.
2           runlevel2.target, multi-user.target   Set up a non-graphical multi-user system.
3           runlevel3.target, multi-user.target   Set up a non-graphical multi-user system.
4           runlevel4.target, multi-user.target   Set up a non-graphical multi-user system.
5           runlevel5.target, graphical.target    Set up a graphical multi-user system.
6           runlevel6.target, reboot.target       Shut down and reboot the system.