This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

ඉර හඳ තරු

කළුවර අහසට ආලෝකය දෙන්න තරු රැසක් මළානික ආලෝකයක් දෙද්දි ආවාට පිරුණු වටකුරු දෙයක් ඒ එළියට වඩා හැමෝම ආස...

සිව්වන වසර ආරම්භය

දැන් මගෙ අතින් බ්ලොග් ලියවෙන්නෙ නැති ද මන්දා.ඒත් ඉතින් සංවත්සරයක් නිසා ලියන්නත් එපැයි.. මාසෙකට පෝස්ට් එකක් දැම්මාට ඕක...

Root නොකර Android එකට සිංහල උගන්වමු

අද කියන්න යන්නේ Android ධාවනය වන ඒවට root නොකර සිංහල දාගන්න විදිය. මුලින්ම කියන්න ඕන මේ ක්‍රමය...


How to Change keyboard Language in CentOS 7 (Keymap)

check current keyboard map information use following command
recently i installed CentOS 7 and accidentally installed en_gb by default loadkeys us
localectl status # to display locale settings
localectl set-locale LANG=en_GB.utf8 # to set the Language
localectl list-locales # to lists locales
localectl list-keymaps # list keyboard mappings
localectl set-keymap uk # sets the key map

empty a file in linux

use following command to empty file named sample.txt

#truncate -s 0 sample.txt


Install mod_security in Centos 7

In Fedora Core, CentOS, and Red Hat Enterprise Linux you just need to run following
# yum install mod_security
when installation complete we can see mod_security.conf file in apache folder
# ls -l /etc/httpd/conf.d
include this line to httpd.conf file
LoadModule security2_module modules/
restart apache
# service httpd restart 


Install LAMP stack on CentOS 7

first need to install epel-release repo on centos 7 just run following command to install epel

yum install epel*

after that we can start install LAMP stack on CentOS7
LAMP stand for followings

L - Linux (CentOS)
A - Apache(httpd)
M - Mysql(mysqld)

now we can install httpd server using following
yum install httpd

this will install Apache server as httpd service

start the httpd service using following command

service httpd start

start httpd with system bootup use following command

chkconfig httpd on

add following firewall rules
firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https 
firewall-cmd --reload

now install mysql using following command

yum -y install mariadb-server mariadb

start mariadb service

service mariadb start

enable with system boot

chkconfig maradb on

set mysql root password


[root@server1 ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <--ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] 
New password: <--yourmariadbpassword
Re-enter new password: <--yourmariadbpassword
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] <--ENTER
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <--ENTER
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] <--ENTER
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <--ENTER
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@server1 ~]#

now test http://localhost or http://ip_of_server/ on browser it gives you a page like following

Testing 123..

This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page it means that this site is working properly. This server is powered by CentOS.
that page saying httpd is working fine

now we can install PHP on centos

just run
yum -y install php

after installing php httpd requires restart

restart httpd using follwoing

service httpd restart

for test php
create a file including followings


and save it in /var/www/html folder as phpinfo.php

check with browser http://localhost/phpinfo.php or http://ip_of_server/phpinfo.php

now install php-mysql using following command to get mysql support in php

yum install php-mysql

then other modules also well

yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
don't forget to restart apache again

service httpd restart

if you need to access mysql using webrowser install phpMyAdmin using following

yum install phpMyAdmin

Linux Networking on terminal and Back with CentOS 7

recently i installed centos 7 and happy to say back to play with linux. so as first step after installation was the configure network. first need to check what are the available interfaces in current system. to check that we can use ifconfing -a command

[root@tecmint ~]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
          RX packets:2344927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2220777 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:293839516 (280.2 MiB)  TX bytes:1043722206 (995.3 MiB)
          Interrupt:185 Memory:f7fe0000-f7ff0000

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5022927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5022927 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2175739488 (2.0 GiB)  TX bytes:2175739488 (2.0 GiB)

then select the interface you need to active and give following command. mostly with ethernet it will be eth0

ifconfig eth0 up 
ifup eth0

[root@tecmint ~]# ifconfig eth0 up
[root@tecmint ~]# ifup eth0

it will try to make connection with dhcp server and request ip and assign that ip to interface
or else we can assign ip to that interface
[root@tecmint ~]# ifconfig eth0

Related Posts Plugin for WordPress, Blogger...