Skip to main content

Posts

Showing posts with the label Linux

Installing JDK on Ubuntu

  OpenJDK To install Open JDK 11 LTS sudo apt-get install openjdk-11-jdk or  sudo apt install default-jdk Oracle JDK For Oracle JDK you have to manually download from the Oracle JDK website and install it. PPA doesn't work well anymore. Manage JAVA   If you have multiple JDK on your machine, you can configure which version to be used using the following command by selecting one. sudo update-alternatives --config java

Get the serial number of a computer using command

Windows Open a command prompt (by choosing the Command Prompt item from the Start menu, or typing cmd in the Start menu's " Run " box), and type the following: wmic bios get serialnumber MacOS Go to Utilities. Open the Terminal application and type: ioreg -l | grep IOPlatformSerialNumber Linux Open a shell and type: sudo dmidecode -t system | grep Serial Note: The user will need to have root access to the system.

Install CyanogenMod 13 on Nexus 4

Let me show you how to install CyanogenMod 13 which is build on Android 6.0.1 since Nexus 4 no longer receives update from Google. I will be explaining you using Debian Linux. Download the latest version of CyanogenMod 13 from Official CyanogenMod website  https://download.cyanogenmod.org/?device=mako . I would recommend Stable release only. Make sure to download system image (CyanogenMod Build), recovery image (CyanogenMod Recovery) and Google App from  https://wiki.cyanogenmod.org/w/Google_Apps .  1. You will need Android SDK platform tool and we will be using fastboot and adb.  2. Now boot the phone in recovery mode, hold down Volume Down  + Power button until bootloader appears, then navigate to Bootloader by clicking volume up/down and select by clicking Power button.  3. Open terminal and then navigate to folder where you have placed Android SDK platform tools. Type  sudo ./fastboot oem unlock if your OEM is locked else...

CentOS 7 and RHEL 7 new commands

In CentOS 7/RHEL 7 the 'service' command has now been changed to systemctl. Now the command are: systemctl start sshd.service  The above line will start sshd service. systemctl restart sshd The above line is a short form command. chkconfig command has also changed. Now to enable service during boot is: systemctl enable sshd To disable service during boot is: systemctl disable sshd To check startup list: systemctl list-unit-files --type=service

Install Wordpress on CentOS/RHEL

Download the latest version of Wordpress extract the zipped filw. 1. wget http://wordpress.org/latest.tar.gz 2. tar xzf latest.tar.gz Now assigning to group and setting folder permission. 1. chown -R apache.apache wordpress 2. chmod -R 755 wordpress Configuring Apache 1. cd /etc/httpd/conf.d/ 2. Create a file wordpress.conf 3. wordpress.conf Alias /wordpress /home/wordpress < Directory /home/wordpress> Order allow,deny Allow from all < /Directory> 4. service httpd restart Browse at localhost/wordpress it should show you wordpress site. That's it. You can use the existing mysql connection and connect to wordpress site.

Update Kali Linux from ISO image with no network

Mount the ISO to /mnt directory sudo mount -t iso9660 -o loop /path/to/iso /mnt/ Modify the /etc/apt/sources.list Add: deb file:///mnt kali main contrib non-free Comment: Comment out all other repository locations from the file except the about one. Update the system sudo apt-get update sudo apt-get dist-upgrade Un-comment We have now updated the system from the ISO, now we need to un-comment back the official repository locations and comment our newly added ISO repository. Un-mount the ISO sudo umount /mnt

How to connect to remote desktop using linux

Remmina has now been moved to FreeRDP. To connect to remote desktop using freerdp command sudo  xfreerdp /size:800x600 /u:administrator /v:192.168.1.1:3389 with the above command I am connecting to 192.168.1.1 windows server where remote desktop is enabled with the screen resolution 800x600. By default remote desktop works on tcp port 3389.

Install Latest LibreOffice in Linux

Download the latest version on LibreOffice from its website. 1. Uncompress the file tar zvxf LibreOfficeXXXX.tar.gz 2. Go to respective folder cd DEBS or cd RPMS 3. Installation dpkg -i *.deb  or yum localinstall *.rpm 4. Desktop Integration cd desktop-integration 5. Install Desktop Integration dpkg -i *.deb or yum localinstall *.rpm * This procedure will work on RedHat & Debian Linux

Install Google Chrome in Linux

Create a new Google Chrome repository file in /etc/yum.repos.d/google.repo. And Add following: [Google-Chrome] name=Google-Chrome - 32bit baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386 enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub For 64bits just change i386 to x86_64 Now use yum to install Stable version of Google Chrome browser. You can use this tutorial for CentOS/RedHat/Fedora/Fuduntu and any distribution related RedHat yum install google-chrome-stable

Set Date and Time on Linux

Check if your date and time are set correctly under your linux box. #date Fri Mar 8 13:40:44 BTT 2013 Set Date : 1. date +%Y%m%d -s "20130308" Set Time : 1. date +%T%p -s "01:12:30PM" Check the Hardware Clock 1. hwclock --show Sync the system date and time with hardware date and time 1. hwclock --systohc

Zimbra Mail Error: not enough free space in mail queue

If you are using Zimbra Mail and you are not able to send any mails and also you see an Error Message " not enough free space in mail queue " under /var/log/message. Then you should try out this solution. 1. Login to the server, and then again login as zimbra as follows: #su - zimbra 2. Check the Postfix message_size_limit, by default it should be 10MB (i.e. '10240000' bytes) as follows: $postconf message_size_limit message_size_limit = 10240000 3. If the value is higher than that, set it as follows to 10MB $ zmprov modifyConfig zimbraMtaMaxMessageSize 10240000 $ postfix reload Now try sending Mail, It should work. You could try out this solution for Error: " SMTP Server Reported: 452 4.3.1 Insufficient System Storage "

Ubuntu packages updating

Ubuntu package/software's are can be updated using GUI tool. In case you want to do it from the terminal you have to use apt-get command. apt-get update Used to sync with package index from the source via Internet. apt-get upgrade Used to perform an upgrade to all existing installed packages apt-get install Used to install new packages on the system or upgrade existing installed system. apt-get purge Used to remove packages and configuration files.

Ubuntu apt-get update Error

If you encounter the following error when you run apt-get update or any command associated with apt-get like the one below E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists / To resolve the above problem run the following commands in sequence. sudo apt-get autoremove sudo apt-get install -f

IP address and MAC filter on Squid

Sometime having a white listed IP group in squid is problematic due to DHCP. It works perfectly on static IP address when assigned to an individual. But if you use MAC address you need not worry about IP address. Squid configuration for IP based filter. acl AllowIP src 192.168.50 acl AllowIP src 192.168.2 http_access allow AllowIP Squid configuration for MAC based filter. Create a file in squid location. Here I have create mac.txt file under squid location i.e (/etc/squid/). acl MAC arp "/etc/squid/mac.txt" http_access allow MAC My mac.txt file would contain something like this. 00:32:1e:7d:2a:00 00:xx:xx:xx:xx:xx * MAC address under windows will be shown as xx-xx-xx-xx-xx-xx where as in Linux xx:xx:xx:xx:xx:xx Make sure that your http_access allow line is before http_access deny all, else your rule will not work.

IPTABLES

Under linux OS, we use iptables to secure the machine from any other external attack. In current scenario I am forwarding the packages from local interface to external interface and i have squid configured which will be acting as transparent proxy. Only selective port numbers are open for the network. 1. Save the script to a file. 2. Give permission to execute. chmod +x filename . 3. Execute the file as follows ./filename 4. save the output of the script to system iptables file, by running the command service iptables save 5. You are done, start/restart the iptables service. service iptables restart Script: #!/bin/sh # chmod +x file name to execute # eth0 LAN # eth1 WAN # Local IP range 192.168.0.0/25 # NATing # Transparent proxy iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A...

Install LibreOffice on Fedora

Download the package from LibreOffice.org 1. Unpack the downloaded package. tar -xvf Libxxxx 2. Installing LibreOffice rpm -Uvh RPMS/*.rpm If you get error here saying libgnomevfs2 is missing. Install the package as follows. yum install ruby-gnomevfs 3. Desktop Integration setup for LibreOffice rpm -Uvh RPMS/desktop-integration/libreofficeX.X-freedesktop-menu-XXXXXXXX

Install MRTG and SNMP

The Multi Router Traffic Grapher (MRTG) is a tool to monitor the network traffic load. With this tool you can even monitor router traffic. Before we configure MRTG, we need a working Simple Network Management Protocol (SNMP) server. 1. Install snmp packages yum install snmp net-snmp net-snmp-utils -y 2. Configure SNMP vi /etc/snmp/snmpd.conf Locate line that contains: com2sec notConfigUser default public Add or change to as follows, in case of 192.168.0.0/24, enter your own internal network range: com2sec local localhost public com2sec mynetwork 192.168.0.0/24 public Locate line that contains: group notConfigGroup v1 notConfigUser group notConfigGroup v2c notConfigUser Add or change to as follows: group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local group MyROGroup v1 mynetwork group MyROGroup v2c mynetwork group MyROGroup usm mynetwork ...

Display uncommented lines of a file

As you must be aware that in any configuration file under Linux OS, there is hundreds of lines, most of them are commented with explanations. Therefore going though such files takes time to locate the line we are looking for. I use the command below to remove all the commented lines and blank lines by combining two commands using pipe '|'. In my case the comments are marked with #. grep -v "^#" main.cf | grep -v "^$" The grep -v "^#" filename will remove the commented line. The grep -v "^$" will remove the blank lines.