Friday, July 14, 2017

How to install phpmyadmin on Linux Centos 7

ssh into your centos 7 box, using root (assuming your centos box ip is 10.0.0.100)
# ssh root@10.0.0.100
 
Install apache web server (httpd)
# yum install httpd
 
Install php, and php-mysql
# yum install php php-myqsl
 
Start apache webserver
# systemctl start httpd
 
Install mariadb-server
# yum install mariadb-server
 
Start mariadb-server
# systemctl start mariadb
 
Secure mariadb-server installation (will set root password, and secure mariadb-server installation)
# mysql_secure_installation 
 
Install epel repo (epel stands for extra package for enterprise linux) 
# yum install epel-release 
 
Install phpmyadmin
# yum install phpmyadmin

Set phpmyadmin to allow ip from local lan (in this case, the local lan ip segment is 10.0.0.0/24), by changing below lines in /etc/httpd/conf.d/phpMyAdmin.conf
# diff -u phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf 
--- phpMyAdmin.conf     2017-07-13 19:24:52.310000000 +0800
+++ /etc/httpd/conf.d/phpMyAdmin.conf   2017-07-13 19:15:50.366000000 +0800
@@ -14,7 +14,7 @@
    
      # Apache 2.4
      
-       Require ip 127.0.0.1
+       Require ip 10.0.0
        Require ip ::1
      
    
@@ -22,7 +22,7 @@
      # Apache 2.2
      Order Deny,Allow
      Deny from All
-     Allow from 127.0.0.1
+     Allow from 10.0.0
      Allow from ::1

@@ -31,7 +31,7 @@
    
      # Apache 2.4
      
-       Require ip 127.0.0.1
+       Require ip 10.0.0
        Require ip ::1
      
    
@@ -39,7 +39,7 @@
      # Apache 2.2
      Order Deny,Allow
      Deny from All
-     Allow from 127.0.0.1
+     Allow from 10.0.0
      Allow from ::
 
Restart httpd
# systemctl restart httpd 

Using your favorite browser, browse to http://10.0.0.100/phpmyadmin, assuming your server ip address is 10.0.0.100 
 

Login using your mysql root and password, that has been set in mysql_secure_installation step
 

Done

Thursday, July 13, 2017

Installing joomla on Centos 7

ssh into your server as root (assuming your server ip is 10.0.0.100)
# ssh root@10.0.0.100

Install database mariadb
# yum install mariadb-server

start mariadb

# systemctl start mariadb

secure mariadb installation and answer yes (this will remove anonymous user, test database, and set root password)
# mysql_secure_installation

create database
# mysql -u root -p
# mariadb> create database joomla;


create user in mariadb
# mariadb> create user joomlauser@localhost;

grant privilege for user to access database
# mariadb> grant all privileges on joomla.* to joomlauser@localhost identified by 'password';

flush privileges
# mariadb> flush privileges;

# exit

Install httpd
# yum install httpd

start httpd

# systemctl start httpd

Install epel
# yum install epel-release

Install php php-mysql php-mcrypt
# yum install php php-mysql php-mcrypt php-xml php-zlib php-json


Restart httpd
# systemctl restart httpd

Download joomla
# wget https://downloads.joomla.org/cms/joomla3/3-7-3/Joomla_3.7.3-Stable-Full_Package.zip?format=zip

Make directory /var/www/html/joomla
# mkdir /var/www/html/joomla

Extract joomla zip file to /var/www/html/joomla
# unzip Joomla*zip -d /var/www/html/joomla


Set apache as owner and group owner
# chown apache.apache -R /var/www/html/joomla

Set permission for apache as user to read/write/exec
# chmod 755 -R /var/www/html/joomla

Allow http in firewall, and make it permanent
# firewall-cmd --add-service=http

# firewall-cmd --add-service=http --permanent

Use your favorite browser to browse to http://10.0.0.100/joomla

Follow the wizard to complete joomla installation, providing mariadb username and password set above

Remove joomla installation directory
# rm -rf /var/www/html/joomla/installation


Once finished, browse to http://10.0.0.100/joomla for user site, or http://10.0.0.100/joomla/administrator for admin site


Done

Wednesday, May 31, 2017

Setting up a passwordless ssh login

To setup a passwordless ssh login to a server, please follow below steps:

Create a keypair using ssh-keygen (press enter on every question asked)
$ ssh-keygen

The above command will generate 2 files, ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. You can check it using ls command
$ ls .ssh

You then will need to transfer the public key to the target server, that you want to setup passwordless ssh login to. Put in the password for the user of the target server 
$ ssh-copy-id username@tar.get.ser.ver

Once done, just ssh as usual, and you will be able to login to target server without any password.
$ ssh username@tar.get.ser.ver




Thursday, April 7, 2016

Extracting files from windows executables (.exe) in linux

I am trying to extract firmimg.d7 from the iDRAC firmware exe file, to be used in a drac update using the drac web interface.

The first thing to do is to strip any prepended data (e.g. a SFX stub) from the archive, using a tool called zip. You can install this tool in centos by running yum install zip.

$ file iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE: PE32+ executable for MS Windows (GUI) Mono/.Net assembly

$ zip -J iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE

$ file iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE: Zip archive data, at least v1.0 to extract

Once the file has been shown as zip archive, the normal unzip program can be used to extract it

$ unzip iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
Archive:  iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
 extracting: bmcexe.bat
 extracting: bmcfexe.bat
  inflating: bmcfw64.exe
  inflating: bmcfwu.cfg
 extracting: bmcinv.bat
  inflating: DellSPMsg.dll
  inflating: dupgenexec.dll
  inflating: dupgeninv.dll
  inflating: dupvalid.dll
  inflating: getSystemId.exe
   creating: hapi/
  inflating: hapi/dcdbas32.cat
  inflating: hapi/dcdbas32.inf
  inflating: hapi/dcdbas32.sys
  inflating: hapi/dcdbas64.cat
  inflating: hapi/dcdbas64.inf
  inflating: hapi/dcdbas64.sys
 extracting: hapi/dcdipm64.sys
  inflating: hapi/dchapi32.dll
  inflating: hapi/dchapi64.dll
  inflating: hapi/dchbas32.dll
  inflating: hapi/dchbas64.dll
  inflating: hapi/dchcfg32.exe
  inflating: hapi/dchcfg64.exe
  inflating: hapi/dchcfl32.dll
  inflating: hapi/dchcfl64.dll
  inflating: hapi/dchesm32.dll
  inflating: hapi/dchipm32.dll
  inflating: hapi/dchipm64.dll
  inflating: hapi/dchtvm32.dll
  inflating: hapi/dciwds32.exe
  inflating: hapi/dcmdev32.exe
  inflating: hapi/dcmdev64.exe
  inflating: hapi/dcwipm32.dll
  inflating: hapi/dcwipm64.dll
  inflating: hapi/hapint.exe
  inflating: hapi/hapint64.exe
  inflating: hapi/omsacntl.exe
  inflating: hapinst.bat
  inflating: package.xml
   creating: payload/
  inflating: payload/firmimg.d7
  inflating: PIEConfig.xml
  inflating: PIEInfo.txt
  inflating: spconfig.xml
  inflating: spsetup.exe
  inflating: winhapi.ini

Now, the firmimg.d7 is ready to be used.