• SELinux - disable security

    From the command line, you can edit the /etc/sysconfig/selinux file. This file is a symlink to /etc/selinux/config. The configuration file is self-explanatory. Changing the value of SELINUX or SELINUXTYPE changes the state of SELinux and the name of the policy to be used the next time the system boots.

    [root@host2a ~]# cat /etc/sysconfig/selinux
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #       enforcing - SELinux security policy is enforced.
    #       permissive - SELinux prints warnings instead of enforcing.
    #       disabled - SELinux is fully disabled.
    SELINUX=permissive
    # SELINUXTYPE= type of policy in use. Possible values are:
    #       targeted - Only targeted network daemons are protected.
    #       strict - Full SELinux protection.
    SELINUXTYPE=targeted
    
    # SETLOCALDEFS= Check local definition changes
    SETLOCALDEFS=0
    
  • CentOS - add HDD on VM

    How to add a VMWARE virtual disk on CentOS.

    *WARNING* THIS CAN RESULT IN FILE SYSTEM CORRUPTION IF DONE IMPROPERLY.
    Backup SERVER is *STRONGLY* recommended.


    First just check the partition table of the virtual disk in the VM

    # fdisk -l

    Now, shutdown the guest in preparation to add the additional virtual disk

    # shutdown

    Check system again

    # fdisk -l

    # fdisk /dev/sdb
    # n {new partition}
    # p {primary partition}
    # 1 {select partition number, by default 1 is the next available}

    # t {select partition id we just made (1)}
    # p {print. the new device should be described as Linux LVM}
    # w {write to memory}

    You will need to reboot if fdisk updated kernel tables, just follow the recommendation message that will show up.

    # reboot

    You can check the partition table after the reboot if you like, make sure it looks like what you expect

    fdisk -l /dev/sdb

    Disk /dev/sdb: 85.8 GB, 85899345920 bytes

    Now, create a new physical volume from the new partition

    # pvcreate /dev/sdb1

    # mkdir /mnt/cache

    Then (I prefer XFS system, you also can use ext4)

    # /sbin/mkfs.xfs -L /mnt/cache /dev/sdb1

    Configuring CentOS 6 to Automatically Mount a File System

    In order to set up the system so that the new file system is automatically mounted at boot time an entry needs to be added to the /etc/fstab file.

    /dev/sdb1    /mnt/cache   xfs    defaults        1 2

    Done.

  • Squid just as home cache proxy

    Set the default value for max-size parameter on any cache_dir.
    The value is specified in bytes, and the default is 4 MB.

    If you wish to get a high BYTES hit ratio, you should probably
    increase this (one 32 MB object hit counts for 3200 10KB
    hits).

     maximum_object_size 10240 KB

     

    To verify your configuration file you can use the -k parse option

    % /usr/local/squid/sbin/squid -k parse

     

    How can I disable Squid's log files?

    To disable access.log:

            cache_access_log /dev/null
    

    To disable store.log:

            cache_store_log none
    

    It is a bad idea to disable the cache.log because this file contains many important status and debugging messages.   However, if you really want to, you can: To disable access.log:

            cache_log /dev/null
  • CentOS - extend volume on VM

    How to resize a VMWARE virtual disk and Resize LVM on CentOS.

    *WARNING* THIS CAN RESULT IN FILE SYSTEM CORRUPTION IF DONE IMPROPERLY.
    Backup SERVER is *STRONGLY* recommended.


    First just check the partition table of the virtual disk in the VM

    # fdisk -l /dev/sda

    Disk /dev/sda: 68.7 GB, 68719476736 bytes
    255 heads, 63 sectors/track, 10443 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 13 104391 83 Linux
    /dev/sda2 14 8354 66999082+ 8e Linux LVM

    Now, shutdown the guest in preparation to resize the virtual disk

    # shutdown

    Resize the guest OS partition using VSphere Client (ESXi) or other VMtool (See VMWare support)

    Boot the AirWave VM guest back up, and add a new partition with the free space of the virtual disk. Make sure to use partition id 8e for Linux LVM.

    # fdisk /dev/sda
    # n {new partition}
    # p {primary partition}
    # 3 {select partition number, by default 3 is the next available}

    # t {select partition id we just made (3)}
    # 8e {Linux LVM partition}
    # p {print. the new device should be described as Linux LVM}
    # w {write to memory}

    You will need to reboot if fdisk updated kernel tables, just follow the recommendation message that will show up.

    # reboot

    You can check the partition table after the reboot if you like, make sure it looks like what you expect

    fdisk -l /dev/sda

    Disk /dev/sda: 85.8 GB, 85899345920 bytes
    255 heads, 63 sectors/track, 10443 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 13 104391 83 Linux
    /dev/sda2 14 8354 66999082+ 8e Linux LVM
    /dev/sda3 8355 10443 16779892+ 8e Linux LVM
    Now, create a new physical volume from the new partition

    # pvcreate /dev/sda3

    Then extend the existing volume group, you may want to use vgdisplay to list and identify the volume groups you have.

    # vgextend VolGroup00 /dev/sda3

    Now, extend the logical volume, again, use lvdisplay to list and identify the logical volumes you have.

    # lvextend -L<TOTAL_VOLUME_DESIRED_SIZE>G /dev/VolGroup00/LogVol00 /dev/sda3
    And finally, resize the filesystem in the logical volume

    # resize2fs /dev/VolGroup00/LogVol00

    Done.

  • Mount SMB share to QNAP

    1. Connect to QNAP over SSH

    2. Create mount point:

    mkdir /share/Public/mntdir

    3. Mount share:

    mount.cifs //IP-OF-SHARE-SERVER/FOLDER /share/Public/mntdir/ -o sec=ntlm,username=USER,password=PASSWORD

  • CentOS notes

    Assign IP address:

    ifconfig -a
    # vi /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0
    IPADDR=192.168.0.2
    NETMASK=255.255.255.0
    GATEWAY=192.168.0.254

    # service network restart

    Now you able to access via SSH:

    Add rest of config to

    DEVICE=eth0
    BOOTPRO=none
    IPV6INIT=no
    NM_CONTROLLED=no
    ONBOOT=yes
    TYPE=Ethernet
    USERCTL=no
    PEERDNS=yes
    DNS1=8.8.8.8
    DNS2=8.8.4.4
    DOMAIN=domain.local

    -= YUM =-

    yum update
    yum clean all

    Change Tomezone:
    cp /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

  • Find Out *nux Distribution Name and Version

     

    cat /etc/*-release

    uname -a

    uname -mrs

  • Update Ubuntu Linux Softwares

    When you logged in to ubuntu Linux ssh concole you getting:
    25 packages can be updated.
    60 updates are security updates.

    Ubuntu Linux can be upgraded using GUI tools or using traditional command line tools such as: 

    1. apt-get command - apt-get is the command-line tool for handling packages.
    2. aptitude command - aptitude is a text-based interface to the Debian GNU/Linux package system including Ubuntu Linux

    I prefer to install updates via apt-get command line:

    1. gpt-get update : Update is used to resynchronize the package index files from their sources via Internet.
    2. apt-get upgrade : Upgrade is used to install the newest versions of all packages currently installed on the system
    3. apt-get dist-upgrade : Install kernel updates on a Ubuntu LTS server
    4. reboot

    For Server Version upgrade from LTS to LTS:

    sudo do-release-upgrade
    

    NOTE: Please always make sure you test the target LTS you're being prompted to upgrade to in a LiveCD on the machine you're using to make sure everything works properly before going in for the real upgrade itself.

  • Ubintu: reset root password

    Boot up the machine, and after the BIOS screen, hold down the left Shift key. You will then be prompted by a menu. (Sometimes you have to choose ADVANCED mode)

    From next menu select the one with the recovery mode in the description

    From Recovery Menu choose Root - Grop a root shell menu

    You should now see a root prompt, something like this:

    root@ubuntu:~#
    

    At this stage you should have a read-only filesystem. You have to remount it with write permissions:

    mount -rw -o remount /
    

    Now we can set the user's password with the passwd command. (In this example I will use jorge as the example, you need to substitute whatever the user's username is):

    root@ubuntu:~# passwd jorge
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    root@ubuntu:~#
    
  • Crontab usage on *nix platform

    Cron is a daemon that executes scheduled commands.
    Cron reads /etc/crontab.
    Cron wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute.
    When executing commands, any output is mailed to the owner of the crontab.
    You should use absolute path names for commands like /bin/ls. This is to insure you call the correct command.

    # Minute   Hour   Day of Month       Month          Day of Week        Command   
    # (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)               
        0        2          12             *                *            /usr/bin/find

    0 0 1 1 * - Run once a year
    0 0 1 * * - Run once a month
    0 0 * * 0 - Run once a week
    0 0 * * * - Run once a day
    0 * * * * - Run once an hour

     

     

AustIT Remote Support

Who's Online

We have 10 guests and no members online

AUST IT - Computer help out of hours, when you need it most.

Find out why we do it for less.

About

AUST IT will help you resolve any technical support issues you are facing onsite or remotely via remote desktop 24/7. More...

Contacts

Reservoir, Melbourne,
3073, VIC, Australia

Phone: 0422 348 882

This email address is being protected from spambots. You need JavaScript enabled to view it.

Sydney: 0481 837 077

Connect

Join us in social networks to be in touch.

Newsletter

Complete the form below, and we'll send you our emails with all the latest AUST IT news.