Showing posts with label Centos. Show all posts
Showing posts with label Centos. Show all posts

Friday, 10 July 2015

HTML to PDF Conversion using "wkhtmltopdf" on Linux

We can convert html to pdf using wkhtmltopdf.

You can download "wkhtmltox"  from official website http://wkhtmltopdf.org/downloads.html

Here i downloaded Centos 64bit.

[root@sysads ~]# wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm


Install wkhtmltox using rpm command


First you need to install xorg-x11-fonts-75dpi dependencies package.

[root@sysads ~]# yum install xorg-x11-fonts-75dpi

 [root@sysads ~]# rpm -ivh wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm
Preparing...                ########################################### [100%]
   1:wkhtmltox              ########################################### [100%]
[root@sysads ~]#

Now you can able to convert HTML to PDF format


[root@sysads ~]# wkhtmltopdf /home/sysads/Desktop/owasp_scan_report/test.html /home/sysads/Desktop/owasp_scan_report/test.pdf
Loading pages (1/6)
Counting pages (2/6)                                              
Resolving links (4/6)                                                      
Loading headers and footers (5/6)                                          
Printing pages (6/6)
Done                                                                           
[root@sysads ~]#


Sunday, 21 October 2012

How to configure wget on a proxy network in Centos

When your Linux Centos system using Proxy server or your network environment require you to use proxy server to go to internet, you may need to configure wget to enable wget to download through that proxy server.  To enable wget download through proxy server for all user on your Centos system, you need to edit the "/etc/wgetrc" configuration file.

 Backup "wgetrc" configuration file before we start edit the "wgetrc" file.

             [root@sysadmin ~]#   cp   -p   /etc/wgetrc   /etc/wgetrc.bkp

Open the /etc/wgetrc configuration file and Remove the comment tag (#) https_proxy,http_proxy,ftp_proxy and use_proxy then put the proxy server address and proxy server port number.

             [root@sysadmin ~]#   vim   /etc/wgetrc



Test using "wget" to download something from internet..



Now you can able to download from Internet using wget command.

Friday, 12 October 2012

How to configure yum on a proxy network in Centos

Now we are going to enable yum update through proxy server on Linux Centos system. So Backup "yum.conf" configuration file before we start edit the yum.conf file.

          [root@sysadmin ~]#   cp  -p   /etc/yum.conf   /etc/yum.conf.bkp


Open the yum.conf configuration file and put the http proxy server address and proxy port number

          [root@sysadmin ~]#   vim   /etc/yum.conf




If the proxy server require a user name and password... edit the /etc/yum.conf and add proxy user username and add proxy user password




 Then execute "yum clean all" command to clean/clear yum cache file




Then execute "yum update" command



I hope, it should work.

Wednesday, 10 October 2012

Install EPEL and RPMFORGE Repository on CentOS 6.3 x86_64

Download and import GPG key for EPEL:

[root@manivel ~]# wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6

Import GPG Key

    [root@manivel ~]# rpm –import RPM-GPG-KEY-EPEL-6

    [root@manivel ~]# rm -f RPM-GPG-KEY-EPEL-6

Download and Install EPEL software :

    [root@manivel ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

    [root@manivel ~]# rpm -ivh epel-release-6-8.noarch.rpm



Download and Install RPMFORGE software :


    [root@manivel ~]#  wget   http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

    [root@manivel ~]#  rpm   -ivh   rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

It should resolve your issue.



Sunday, 20 May 2012

Extenal HDD mounting error on centos

I am trying to mount an external hard disk

[root@sysadmin ~]# mount   /dev/sdb1 /mnt/HDD/

mount: you must specify the file system type

but i am getting error. So i specified the file system type

[root@sysadmin ~]# mount -t ext4 /dev/sdb1 /mnt/HDD/

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
      missing codepage or helper program, or other error
      In some cases useful info is found in syslog - try
      dmesg | tail  or so




Solution:



Step: 1

I checked HDD detected or not, using following command

[root@sysadmin ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd967d967

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       31871   256000000   83  Linux
/dev/sda2   *       31871       60419   229313536   83  Linux
/dev/sda3           60419       60802     3072000   82  Linux swap / Solaris

Disk /dev/sdb: 2000.4 GB, 2000398933504 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x584d2cea

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243201  1953512001    7  HPFS/NTFS


HDD detected. Hard disk name /dev/sdb1



Step:2

I installed the fuse-ntfs-3g-2010.10.2-1.el5.rf.x86_64 rpm package.

  #  yum   install  fuse-ntfs
                or
  #  wget http://marush.com/wp-content/uploads/2009/03/ntfs-3g-200921-el5i686.rpm

# rpm -ivh ntfs-3g-200921-el5i686.rpm

After installed that package again i tried

[root@sysadmin ~]# mount   /dev/sdb1 /mnt/HDD/

I mounted the External HDD.


Saturday, 5 May 2012

How to Disable SELinux and Firewall on Centos


Disable Security Enhanced Linux (SElinux) 


If you want to stop temporarily SELinux using below steps

  [root@localhost ~]# setenforce 0

Check Security Enhanced Linux status using following command

            [root@sysadmin]#  getenforce

            Disabled

If you want to stop permanently  SELinux using below steps

 [root@sysadmin]#  vim /etc/selinux/config





Disable Firewall setting


           [root@sysadmin ~]#   system-config-firewall-tui



Remove  "* " symbol then click OK. Now firewall was disabled.


Friday, 6 January 2012

How to Setup Static or Dynamic IP Address in Centos

After centos operting system installation, i can't able to communicate another machine. At that time i checked and found my machine network interface (eth0) down. I got my network interface information using "ifconfig" command

            [root@localhost ~]# ifconfig

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

Above result is showing network interface down. So i used below command to up the interface.

             [root@localhost ~]#  ifup  eth0

After that again i checked. It was up

              [root@localhost ~]# ifconfig

                    eth0      Link encap:Ethernet  HWaddr 10:78:D2:54:19:BD  
                                 inet6 addr: fe80::1278:d2ff:fe54:19bd/64 Scope:Link
                                 UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1
                                RX packets:1055 errors:0 dropped:0 overruns:0 frame:0
                                TX packets:4 errors:0 dropped:0 overruns:0 carrier:5
                                collisions:0 txqueuelen:1000 
                                RX bytes:88232 (86.1KiB)  TX bytes:328 (328.0 b)

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

I had tried two methods for setting up ip address,

    1. DHCP IP Address
    2. Static IP Address

Network interface configuration file location "/etc/sysconfig/network-scripts/ifcfg-eth0 "

Configure Dynamic IP Address :


 First i configured dynamic ip address for my machine. This steps i used for that.
        

         [root@localhost ~]# vim  /etc/sysconfig/network-scripts/ifcfg-eth0

                                  DEVICE="eth0"
                                  BOOTPROTO="dhcp"
                                  HWADDR=10:78:D2:54:19:BD
                                  NM_CONTROLLED="yes"
                                  ONBOOT="yes"
                                  TYPE="Ethernet"
                                  UUID="6b03d1a2-8bb1-4d7b-bd03-8a2e2b4acccf"

                      : wq

After that i restarted the network service

         [root@localhost ~]#  /etc/init.d/network  restart

Configure Static IP Address :


Second i tried static ip address for my machine. This steps i used for that

        [root@localhost ~]# vim  /etc/sysconfig/network-scripts/ifcfg-eth0

                                  DEVICE="eth0"
                                  BOOTPROTO="static"
                                  HWADDR=10:78:D2:54:19:BD
                                  NM_CONTROLLED="yes"
                                  ONBOOT="yes"
                                  TYPE="Ethernet"
                                  UUID="6b03d1a2-8bb1-4d7b-bd03-8a2e2b4acccf"
                                  IPADDR=192.168.0.100
                                  NETMASK=255.255.255.0
                                
                              :wq  


After that i restarted the network service

             [root@localhost ~]#  /etc/init.d/network  restart