Friday, 14 February 2020

Rhel7.3 intranet




Choose web server during Install and select

a) Debugging tools

b)Hardware monitoring utilities

c)Java platform

d)Large systems performance

e)Performance tools

f)Perl for web

g)python

h)Remote management for Linux

i)compatibility Libraries

j)Development tools

k)security tools

Credit :https://www.adminschoice.com/red-hat-7-x-installation-step-by-step-guide

     During installation choose server with gui and other tools. Format harddisks using configuration utility.
    1  mkdir /mnt/cdrom
    2  mount /dev/sr0 /mnt/cdrom
    3  vi /etc/yum.repos.d/rhel7.repo

[rhel7]
name=rhel7
baseurl=file:///mnt/cdrom/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


---------------------------------------------------------------------------------------------------------------------------------------------------------




yum groupinstall "X Window System" Desktop
yum groupinstall gnome-desktop x11 fonts
systemctl set-default graphical.target




--------------------------------------------------------------------------------------------------------------------------------------------------------


credits( to read):
👉Https://Alvinalexander.Com/Blog/Post/Linux-Unix/Create-Aliases
👉Create Alias Instead Of Typing Long Commands


alias go="cd /usr/local/src/lamps"


copy the contents from 192.168,1.2rhel7.3 and place them in /usr/local/src/lamps
scp -r /home/praveen/Desktop/praveen/items/Desktop/servers/192.168.1.2rhel7.3/ root@10.36.5.6:/usr/local/src/lamps

---------------------------------------------------------------------------------------------------------------------------------------------------------


sudo yum install binutils.x86_64 compat-libcap1.x86_64 compat-libstdc++-33.x86_64 compat-libstdc++-33.i686 compat-gcc-44 compat-gcc-44-c++ gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libXext.i686 libXext.x86_64 libXtst.i686 libXtst.x86_64 libX11.x86_64 libX11.i686 libXau.x86_64 libXau.i686 libxcb.i686 libxcb.x86_64 libXi.i686 libXi.x86_64 make.x86_64 unixODBC unixODBC-devel sysstat.x86_64

rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

vim /etc/sysctl.conf
     kernel.shmmax = 4294967295
     kernel.shmall = 2097152
     fs.aio-max-nr = 1048576s
     fs.file-max = 6815744
     kernel.shmmni = 4096
     kernel.sem = 250 32000 100 128
     net.ipv4.ip_local_port_range = 9000 65500
     net.core.rmem_default = 262144
     net.core.rmem_max = 4194304
     net.core.wmem_default = 262144
     net.core.wmem_max = 1048576

sudo groupadd -g 54321 oracle

sudo groupadd -g 54322 dba

sudo groupadd -g 54323 oper

sudo useradd -u 54321 -g oracle -G dba,oper oracle

sudo usermod -a -G wheel oracle

sudo passwd oracle

sudo mkdir -p /u01/app/oracle/product/12.1.0/db_1

sudo chown -R oracle:oracle /u01

sudo chmod -R 775 /u01

vim /home/oracle/.bash_profile

## Oracle Env Settings
     export TMP=/tmp
     export TMPDIR=$TMP
     export ORACLE_HOSTNAME=kapila
     export ORACLE_UNQNAME=orcl
     export ORACLE_BASE=/u01/app/oracle
     export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
     export ORACLE_SID=orcl
     export PATH=/usr/sbin:$PATH
     export PATH=$ORACLE_HOME/bin:$PATH
     export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
     export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib


vim /etc/security/limits.d/90-nproc.conf
* - nproc 16384

go

unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip

cd database/
./runInstaller


--------------------------------------------------------------------------------------------------------------------------------------------------------

tar -zxvf jpegsrc.v8c.tar.gz
cd jpeg-8c/
export cc="gcc -arch i386"
./configure
make
make install


tar -zxvf libxml2-git-snapshot.tar.gz
cd libxml2-2.9.4/
./configure
make
make install


tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure
make
make install


yum install libpng


tar -zxvf libgd-2.2.4.tar.gz
cd libgd-2.2.4/
./configure
make
make install



yum install pcre*

Took 1 week to figure out ./config command

cd openssl-1.0.2/
make clean
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared -fPIC
make
make install
go


cd httpd-2.4.23
cd srclib/
go
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2/
./configure
make
make install
cd ..
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4/
./configure --with-apr=../apr-1.5.2
make
make install
cd ..
cd srclib/
ln -s apr-1.5.2 apr
ln -s apr-util-1.5.4 apr-util


cd httpd-2.4.23
./configure --prefix=/usr/local/httpd  --with-ssl=/usr/local/openssl --enable-mods-static=ssl --enable-so --enable-modules=all
make
make install

ln -s /usr/local/httpd/bin/apxs /usr/sbin/apxs

--------------------------------------------------------------------------------------------------------------------------------------------------------


yum remove mariadb*



rpm -ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm

updatedb

locate mysql.h

mysql -V

service mysqld start

chkconfig --level 2345 mysqld on



cat /var/log/mysqld.log | grep "temporary"
2019-12-09T07:52:32.798739Z 1 [Note] A temporary password is generated for root@localhost: jz*d.5?l(DI2
2019-12-09T07:52:47.645822Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables

mysql -u root -p
Enter password:jz*d.5?l(DI2


mysql> SET GLOBAL validate_password_policy=LOW;

mysql> SET PASSWORD = PASSWORD('AbcD2019');

mysql> commit;

--------------------------------------------------------------------------------------------------------------------------------------------------------

tar -zxvf mod_auth_mysql-3.0.0.patched.tar.gz

cd mod_auth_mysql-3.0.0/

cp ../mod_auth_mysql_3.0.0_patch_apache2.4.diff .

cp ../mod_auth_mysql-3.0.0-redmine.patch .

patch < mod_auth_mysql_3.0.0_patch_apache2.4.diff    (This line is not required )

patch < mod_auth_mysql-3.0.0-redmine.patch

patch < mod_auth_mysql_scrambled_patch

cp /usr/local/httpd/bin/apxs /usr/local/bin/

apxs -c -L/usr/lib64/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c

apxs -i mod_auth_mysql.la

vi /usr/local/src/lamps/mod_auth_mysql-3.0.0/mod_auth_mysql.c


apxs -c -L/usr/lib64/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c

apxs -i mod_auth_mysql.la


--------------------------------------------------------------------------------------------------------------------------


If php-pear is not installed then phpize and zts i.e zend thread safety wiull also be not installed.

When you run apachectl like /usr/local/httpd/bin/apachectl following error will occur

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.


I got error like above.


yum install php-pear

cd php-7.1.3/

export CPPFLAGS='-I/usr/lib64/'

export LDFLAGS='-L/usr/lib64/'

./configure --with-apxs2=/usr/local/httpd/bin/apxs --with-mysqli --enable-sysvshm --enable-sysvsem --enable-ftp --enable-calendar --with-config-file-path=/etc --with-gd --with-jpeg-dir=/usr/local/src/lamps/jpeg-8c/ --with-png-dir=/usr/local/src/lamps/libpng-1.6.28 --with-zlib-dir=/usr/local/src/lamps/zlib-1.2.11 --with-oci8=/u01/app/oracle/product/12.1.0/db_1/ --with-libxml-dir=/usr/local/src/lamps/libxml2-2.9.4

make clean

make

make test

make install

Had a similar issue, using make clean before make solved this error.ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

go

cp php.ini /etc/

see if php thread is enabled or not.

php -i|grep Thread

credit:https://askubuntu.com/questions/386315/how-to-add-libraries-path-to-the-configure-command
https://stackoverflow.com/questions/9845139/php-installation-fails-in-sapi-cli-php


-------------------------------------------------------------------------------------------------------------------------------------------------------

sometimes the software cannot find the shared object .so so add the path to /etc/ld.so.conf and give the command ldconfig

cd /usr/local/httpd/conf/

openssl genrsa -des3 -out ca.key 1024

The following error comes openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
To solve the error give ldconfig
.

CREATING CERTIFICATE taken from lamps efactory.de
cd /usr/local/httpd/conf/
openssl genrsa -des3 -out ca.key 1024

You have to enter a password twice ex openssl. After executing the next command, this password has to be entered again. Afterwards, the CA data is requested to create the certificate.

openssl req -new -x509 -days 700 -key ca.key -out ca.crt

Country Name: in
State or Province: karnataka
Localty Name: ulsoor
Organization Name: bsnl
Organizational Unit Name: computersection
Common Name: ktkint
Email Address: praveenn@bsnl.co.in

Now, we generate the server key. Again, a password is necessary. We back up the key and encode it, so that Apache will not demand a password after each reboot.

openssl genrsa -des3 -out server.key 1024

mv server.key server.key.secure

openssl rsa -in server.key.secure -out server.key

Creating a server certificate is similar to creating the CA certificate, but no password is needed, since the key is already encoded.

Note: In order to go live, the "common name" has to match the server's host adress.

openssl req -new -days 700 -key server.key -out server.csr

Country Name: in
State or Province: karnataka
Localty Name: ulsoor
Organization Name: dot
Organizational Unit Name: computers
Common Name: ktkint
Email Address: praveen5238@gmail.com
A challenge password:openssl
An optional company name:dot

Finally, the certificate is signed by our self made CA and the keys are copied to their own folders. Therefore, we use Ralf S. Engelschall's bash script which may be downloaded here. It is best to save the script in /usr/local/bin and to make it executable by chmod 744.

The CA password has to be entered and it has to be confirmed twice by "y".

sign.sh server.csr
mkdir ssl.crt ssl.key

credit:https://github.com/openssl/openssl/issues/3993

--------------------------------------------------------------------------------------------------------------------------------------------------------


cd /usr/local/httpd/conf

mv httpd.conf httpd.conf.ori


cp /usr/local/src/lamps/httpd.conf .
cp /usr/local/src/lamps/bbmultiplay.conf extra/
cp /usr/local/src/lamps/chpartner.conf extra/
cp /usr/local/src/lamps/polvpn.conf extra/
cp /usr/local/src/lamps/sieb.conf extra/
cp /usr/local/src/lamps/nagios.conf extra/


or run the below command

cp /usr/local/src/lamps/extra/*.conf extra/


go

cp -avr ktkint_auth /etc

chmod -R 755 /etc/ktkint_auth

---------------------------------------------------------------------------------------------------------------------------------------------------------

From live server

rsync -av /var/www/html/ root@10.36.5.6:/var/www/html

rsync -av /var/lib/mysql/ root@10.36.5.6:/var/lib/mysql


------------------------------------------------------------------------------------------------------------------------------------------------------
go

mkdir kannel

svn co https://svn.kannel.org/gateway/trunk gateway   Not used

svn co https://svn.kannel.org/sqlbox/trunk sqlbox     Not used

ls -ld gateway

ls -ld sqlbox

 yum install gettext-devel

tar -zxvf kannel-snapshot.tar.gz

cd kannel-snapshot/

./configure --with-mysql --with-mysql-dir=/var/lib/mysql/ --enable-debug

If the above command says lttool n ot available then give following command

ln -s /usr/share/libtool/config/ltmain.sh ltmain.sh

./configure --with-mysql --with-mysql-dir=/var/lib/mysql/ --enable-debug

make

make install

 cd addons/sqlbox/

./configure --with-kannel-dir=/usr/local/include/kannel/ --prefix=/usr/local --with-ssl=/usr/local/openssl/lib/

make

make install

useradd kannel

groupadd kannel

usermod -G kannel kannel

cd /var/log

mkdir kannel

chown -R kannel.kannel kannel

go

cp kannel.conf.smpp /etc

cp kannel_smpp /etc/rc.d/init.d/

cp sqlbox.conf.smpp /etc

chown kannel:kannel kannel.conf.smpp

chown kannel:kannel sqlbox.conf.smpp

Here make sure kannel database is there .so do rsync if nopt already done.

service kannel_smpp start

ps -A | grep box

Instead of running kannel_smpp start we can give command like this also

bearerbox kannel.conf.smpp &
sqlbox sqlbox.conf.smpp &
smsbox kannel.conf.smpp &


----------------------------------------------------------------------------------------------------------------------------------------------------------


rsync -av /var/www/html/ root@10.36.5.6:/var/www/html
rsync -av /var/lib/mysql/ root@10.36.5.6:/var/lib/mysql


----------------------------------------------------------------------------------------------------------------------------------------------------------


service firewalld stop

Ensure the ip used is configured in httpd.conf


/usr/local/httpd/bin/apachectl start

service mysqld restart

tail -f /var/log/httpd/ktkint-error.log now browse the pages.

https://10.36.5.6/server-status

check the mpm module

vi /usr/local/httpd/conf/extra/httpd-mpm.conf

change the settings to 4000 instead of 0 .If it is 0 then connections can be unlimited which will increase cpu usage in server-status

MaxConnectionsPerChild   4000




That's it