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.

Wednesday, March 30, 2016

How to determine your proxy ip address and port using curl

This is very easy, what you have to do is use curl to access any site, and curl will let you know what is the proxy address if you have not put in your authentication details. See below example:

foobar@ubuntu-vm:~$ curl www.google.com -IL
HTTP/1.1 302 authenticationrequired
Date: Tue, 26 Jan 2016 06:46:15 GMT
Location: http://10.155.120.23:9090/mwg-internal/de5fs23hu73ds/plugin?target=Auth&reason=Auth&ClientID=2297288988&ttl=600&url=aHR0cDovL3d3dy5nb29nbGUuY29tLw==&rnd=1453790775
Connection: Keep-Alive
Content-Type: text/html
Cache-Control: no-cache
HTTP/1.1 401 authenticationrequired
Date: Tue, 26 Jan 2016 06:46:15 GMT
Connection: Keep-Alive
Content-Type: text/html
Cache-Control: no-cache
WWW-Authenticate: NTLM
WWW-Authenticate: Basic realm="MY COMPANY WEB GATEWAY"

You can see from above that my proxy ip address is 10.155.120.23, and my proxy port is 9090.

Monday, February 15, 2016

How to free reserved space on ext2/3/4 partitions

Linux by default, set aside around 5% of the total space in a partition for the root user and system service. For systems partition like /, this does make sense, since you won't be able to login if your / is full, but for other partitions, it does not seems that the reserve will help in any way.

You can find how much is being set as reserved by running:

$ sudo tune2fs -l /dev/sda1 | grep 'Reserved block count'
Reserved block count:     27709

So, for ext3/4 partitions, you can reclaim that reserve space by setting the reserve count to 0:
$ sudo tune2fs -m 0 /dev/sda1

Reserved block count will be 0% after the above command
$ sudo tune2fs -l /dev/sda1 | grep -i 'Reserved block count'
Reserved block count:     0

You can now fully enjoy the maximum space available for your partition.