Tag Archives: centos

Linux : Add Active Directory Authentication on CentOS 7

Firstly, we need to make sure our Active Directory (AD) account has the privilege to add/join any server to domain server. Contact AD administrator.
on CentOS 7 :-

  1. Install ssd, realmd, adcli
  2. Install ossjob, ossjob-mkhomedir, krb5-workstation,openldp-clients  (OPTIONAL)
  3. Run the following command to add, check
    • # realm join –user=<yourusername><space><yourdomain> .
      e.g : realm join –user=apitto myapitdomain.com
    • # realm list
    • realm discover -v myapitdomain.com
  4. Add user AD to your server
    • #su – <full-user-name-with-domain>
      e.g: su – pengurus@myapitdomain.com

Done.

Tested on CentOS 7.

Advertisements

Linux : Add new startup script using Systemd

I has been working with current CentOS 7 using Systemd feature. Here is the script I use to start one of my program.

Create an empty file with name <what ever name>.service

Filename: runbind.service

Content of the file :

BOF >>>
[Unit]
Description=Runbind Reload
After=syslog.target
After=network.target


[Service]
Type=simple
User=root
Group=root
ExecStart=/bin/sh /opt/runbind.sh
Restart=always


# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300


[Install]
WantedBy=multi-user.target

<<<EOF

Save this file in /usr/lib/systemd/system/

Note: You will want to change this parameters :-

Please exclude BOF and EOF lines
User -> which user account you need to run this script
Group -> user’s group
ExecStart-> full path to your program or script
Description-> description of the script

Tested on CentOS Linux release 7.2.1511 (Core)

 

Credit to : 
https://www.redmine.org/boards/1/topics/32763?r=43267
https://www.digitalocean.com/community/tutorials/how-to-configure-a-linux-service-to-start-automatically-after-a-crash-or-reboot-part-1-practical-examples

 

Linux : Loading new kernel without “really” rebooting the server – CentOS

This is VERY interesting article I found on the internet. 
Thanks to KoRoVaMiLK#

You have that server you can’t reboot but need to patch the kernel NOW (eg. #kernel flaw found#).. well, you can try this out.

First of all, we print out running kernel version:

# uname -r
2.6.32-71.29.1.el6.i686

Ok, we have to patch:

# yum update kernel*

Grab the kexec tools:

# yum install kexec-tools

Now we get last installed kernel version release and put it on a var:

# latestkernel=`ls -t /boot/vmlinuz-* | sed "s/\/boot\/vmlinuz-//g" | head -n1`

# echo $latestkernel
2.6.32-220.4.1.el6.i686

Now we need to load the new kernel version in memory:

# kexec -l /boot/vmlinuz-${latestkernel} --initrd=/boot/initramfs-${latestkernel}.img --append="`cat /proc/cmdline`"

Finally, we can issue a reset:

# kexec -e

..and.. wow, we lost the system! ..Well, not exactly.

The system will “restart without restarting”..something like a fast reboot, without performing BIOS checks (and you know how long can a full system restart last).

# uname -r
2.6.32-220.4.1.el6.i686

It worked!

* Be aware that kernel reset will perform a connection reset as well, together with resetting your uptime, so if you’re searching for something to grant your uptime record while security patching, well, this is not for you.

 

Credit to :

http://blog.agate.io/post/16460518079/running-new-linux-kernel-without-rebooting

Installing module sybase_ct in CentOS 6.x with php 5.4

Firstly,  you may need to import/installl remi repos and development tools into your CentOS.

Then, install php,apache and freetds using yum :

#yum install httpd php freetds freetds-devel
#php -i (to identify php version installed)

Go to php.net and download the php souce code same version as above.
Extract it, and be prepare to compile the souce code.

#./configure –with-sybase-ct=shared,/usr
#make
# cp modules/sybase_ct.so /usr/lib64/php/modules
#cd /etc/php.d/
#vim sybase.ini

and enter the following text;

; Enable SAIBESSSS extension module
extension=sybase_ct.so

restart your apache, and create file contain <?php phpinfo(); ?> to check whether the module successfully installed or not. You also can check from terminal by running # php -i | grep sybase
Teston On CentOS 6.6 , PHP 5.4.38, Apache 2.2