Pages

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, May 23, 2020

How to install Ajenti control panel.



Ajenti is a modern, lightweight, open source, web-based control panel for managing virtual private servers (VPS).

Using Ajenti, an administrator can control a Linux server from a browser with its responsive web interface, which otherwise requires the use of a terminal. Optionally, one can extend the functionalities of Ajenti using few existing plug-ins or develop a custom plugin from scratch using Python.

Supported operating systems:

  • Debian 9 or later
  • Ubuntu Bionic or later
  • CentOS 8 or later
  • RHEL 8 or later

Other Linux-based systems might work, but you’ll have to use manual installation method.

Automatic Installation

curl https://raw.githubusercontent.com/ajenti/ajenti/master/scripts/install.sh | sudo bash -s -

Thursday, October 31, 2019

Set Password or SSH Key for CentOS Cloud Images using virt-sysprep

Step 1: Install virt-sysprep

Type the following apt-get command/apt command to install virt-sysprep on a Debian or Ubuntu Linux:

$ sudo apt install libguestfs-tools


If you are using a CentOS/RHEL/Oracle/Scientific Linux, type the following yum command:

$ sudo yum install libguestfs-tools


If you are using a Fedora Linux, type the following dnf command to install the same:

Saturday, May 11, 2019

How to Secure your Server

Here are some quick tips on how to secure your Linux server. This is only a short list, but, they are must do’s! Some of which are:

1. Change ssh port (use keys if possible as well/allow only specific users)
2. Disable unneeded services
3. Install a good firewall
4. Disable dangerous / unused PHP functions / harden your PHP
5. Install mod_security
6. Virus scan FTP uploads
7. Install root kit detection
8. Set root email to off server email account
9. Make sure your passwords are tough to guess. This is a big one, especially for the root user, this should be a very tough password.

This is a quick list, as there are many other things that can be done.

Wednesday, December 5, 2018

dd command to migrate VPS on linux platform

First create new vps with same configuration on another node. It doesn't matter new vps is having os or not or you can choose any OS.

Once same configuration VPS setup done then use below command to migrate VPS.

    dd if=/dev/guestos/kvm2351_img | ssh 10.10.10.10 "dd of=/dev/guestos/kvm2520_img"

Saturday, September 16, 2017

dd command to migrate VPS on linux platform

First create new vps with same configuration on another node. It doesn’t matter new vps is having os or not or you can choose any OS.

Once same configuration VPS setup done then use below command to migrate VPS.

    dd if=/dev/guestos/kvm2351_img | ssh 10.10.10.10 “dd of=/dev/guestos/kvm2520_img

Once migration is completed then try starting VPS on new node.

Sunday, August 16, 2015

Find Linux OS is 32 or 64bit

There are several situations where you need to confirm whether your Linux OS installed  is 32bit or 64bit. People normally use uname -a to find it. But the following command will tell you exactly the machine   architecture.

    getconf LONG_BIT

getconf utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility  Syntax.

eg:

[root@localhost ~]# getconf LONG_BIT
32
[root@localhost ~]#

My machine is 32bit.

Saturday, November 29, 2014

How to Block an IP Address on a Linux server

To block an IP on your Linux server you need to use iptables tools  and netfilter firewall. First you need to log into shell as root user. To block an IP address you need to type the iptables command as follows:

# iptables -A INPUT -s IP-ADDRESS -j DROP

Replace IP-ADDRESS with your actual IP address. For example, if you wish to block an ip address 103.575.713.93 for whatever reason then type the command as follows:

# iptables -A INPUT -s 103.575.713.93 -j DROP

If you have IP tables firewall script, add the above rule to your script.If you just want to block access to one port from an ip 103.575.713.93 to port 22 then type command:

# iptables -A INPUT -s 103.575.713.93 -p tcp --destination-port 22 -j DROP

How to Setup Minecraft on a Linux CentOS Server

Installation
============
Installation is quite straightforward:

rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

Next, test whether you have the required iptables modules:

perl /usr/local/csf/bin/csftest.pl

Don't worry if you cannot run all the features, so long as the script doesn't
report any FATAL errors

Saturday, September 6, 2014

How to install CHKRootkit

Install CHKROOTKIT
Product Name: CHKROOTKIT
Product Version: 0.49
Homepage: http://www.chkrootkit.org/

Description: chkrootkit (Check Rootkit) is a common Unix-based program intended to help system administrators check their system for known rootkits. It is a shell script using common UNIX/Linux tools like the strings and grep commands to search core system programs for signatures and for comparing a traversal of the /proc filesystem with the output of the ps (process status) command to look for discrepancies.
It can be used from a “rescue disc” (typically a LiveCD) or it can optionally use an alternative directory from which to run all of its own commands. These techniques allow chkrootkit to trust the commands upon which it depends a bit more.

There are inherent limitations to the reliability of any program that attempts to detect compromises (such as rootkits and computer viruses). Newer rootkits may specifically attempt to detect and compromise copies of the chkrootkit programs or take other measures to evade detection by them.
Step 1: Downloading and Installing it:

cd /usr/local/src
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.md5 md5sum -c chkrootkit.md5
tar -zxvf chkrootkit.tar.gz
mkdir /usr/local/chkrootkit
mv /usr/local/src/chkrootkit*/* /usr/local/chkrootkit
cd /usr/local/chkrootkit
make sense Step 2: Adding program to daily cron job
There you go! should be installed, and you will get a mail daily with a status on your system

Saturday, December 7, 2013

Find Linux OS is 32 or 64bit.

There are several situations where you need to confirm whether your Linux OS installed  is 32bit or 64bit. People normally use uname -a to find it. But the following command will tell you exactly the machine   architecture.
getconf LONG_BIT
getconf utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility  Syntax.
eg:
[root@localhost ~]# getconf LONG_BIT
32
[root@localhost ~]#
My machine is 32bit.

How to enable DKIM in cPanel server.

DomainKeys Identified Mail (DKIM) lets an organization take responsibility for a message while it is in transit and one can use this to prevent from getting blacklisted by the free email providers like Yahoo, MSN and Google. DKIM can increase the mail authenticity.

cPanel does not have an interface to enable DKIM like we have for SPF and Domain Keys. cPanel is still working on it for getting it implemented. However we can enable it manually by following the below steps.

Check if exim is compiled with DKIM support enabled.

 [bash]root@server # /usr/sbin/exim -dd 2>&1 | grep Experimental_DKIM[/bash]
    [bash]Support for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning Old_Demime Experimental_SPF Experimental_SRS
    Experimental_DomainKeys Experimental_DKIM[/bash]

Tuesday, November 26, 2013

How to change your hostname with SSH

If you’ve worked in the admin world for any length of time, you’ve probably run into an instance where you needed to change the hostnames on your server to match some corporate naming standard, but you can’t have downtime either.

Changing the Hostname


First, you must change the config file that controls this. The actual file and its location will vary across distributions. In the Redhat derivatives, the file to modify is /etc/sysconfig/network so vi this file and change the line that reads HOSTNAME=

Monday, July 8, 2013

How do I check what version of CentOS

To obtain the version of CentOS your server is running, from command line issue the following:

cat /etc/*release*

How do I enable mod_rewrite in Apache2 on Debian?

Enabling mod_rewrite in apache2 is a simple procedure.

Type the following:
a2enmod rewrite

Edit /etc/apache2/sites-available/000-default or it may be called /etc/apache2/sites-available/default

and change the following line:

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

change it to:

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all

Lastly, restart apache2:

/etc/init.d/apache2 restart

How to install ZPanel on ubuntu 12.04 x86_64

1) Ensure that you're using a server or VPS with a clean install of Ubuntu 12.04. This tutorial will focus on using Neosurge's VPS hosting solutions.

2) Log into the VPS or server as root.



3) Ensure all system packages are up to date and wait for the update and upgrade has completed by entering the following command:

Monday, July 1, 2013

CentOS - Hostname Change

There are 4 steps in a hostname change, luckily all the steps are easy.

Sysconfig/Network

Open the /etc/sysconfig/network file with your favorite text editor. Modify the HOSTNAME= value to match your FQDN host name.

# sudo nano /etc/sysconfig/network
HOSTNAME=myserver.domain.com

Hosts File

Change the host that is associated to your main IPaddress for your server, this is for internal networking (found at /etc/hosts):




 

Run Hostname

The 'hostname' command will let you change the hostname on the server that the commandline remembers, but it will not actively update all programs that are running under the old hostname.




Restart Networking

At this point all the necessary changes that needed to be made have been made, you will want to restart networking on your server to make sure that changes will be persistent on reboot:

# /etc/init.d/network restart

Friday, April 12, 2013

Upgrade ssh on Linux

#!/bin/bash
#Configuration:
temp_working_directory=/usr/local/src
openssh_source_link=http://filedump.se.rit.edu/pub/OpenBSD/OpenSSH/portable/openssh-5.6p1.tar.gz
install_prefix=/usr

#Saving old sshd init script:
cp -a /etc/rc.d/init.d/sshd /etc/rc.d/init.d/sshd.save

#Uninstall OS installed SSH
rpm -e openssh openssh-clients openssh-server
##Installing OpenSSH 5.6p1 from source:

Error while updating YUM

Today While updating yum on one of the server I  face the error as below :
=============================================================
[root@323191 yum.repos.d]# yum update
Loaded plugins: fastestmirror
Setting up Remove Process
No Match for argument: epel
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 285, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 136, in main
result, resultmsgs = base.doCommands()
File “/usr/share/yum-cli/cli.py”, line 438, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File “/usr/share/yum-cli/yumcommands.py”, line 419, in doCommand
return base.erasePkgs(extcmds)
File “/usr/share/yum-cli/cli.py”, line 861, in erasePkgs
self._checkMaybeYouMeant(arg, always_output=False)
File “/usr/share/yum-cli/cli.py”, line 647, in _checkMaybeYouMeant
matches = self.doPackageLists(patterns=[arg], ignore_case=False)
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 2327, in doPackageLists
avail = self.pkgSack.returnNewestByNameArch(patterns=patterns,
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 897, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 682, in _getSacks
self.repos.populateSack(which=repos)
File “/usr/lib/python2.6/site-packages/yum/repos.py”, line 265, in populateSack
self.doSetup()
File “/usr/lib/python2.6/site-packages/yum/repos.py”, line 92, in doSetup
self.ayum.plugins.run(‘postreposetup’)
File “/usr/lib/python2.6/site-packages/yum/plugins.py”, line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))
=============================================================
Resolution :
Open File: /etc/yum/pluginconf.d/fastestmirror.conf
vi /etc/yum/pluginconf.d/fastestmirror.conf
Change enabled=1 TO enabled=0
and Fire command
[root@323191 yum.repos.d]# yum clean all
[root@323191 yum.repos.d]# yum update
It should be fixed

Thursday, March 28, 2013

Increase PHP Memory Allowance Using ini_set()

On rare occasion, I need to up the memory allowed for PHP. Usually it's when I deal with large files and don't necessarily care about optimizing the file reading process but simply getting the file opened. There's an easy way to increase to amount of memory allowed to PHP right in your script:

ini_set('memory_limit','16M');

Wednesday, March 27, 2013

How to install ClamAV on Linux / Centos

This hopefully should help with your installation of ClamAV.

How to install.
#1. Download the file using wget.
$ sudo wget http://pkgs.repoforge.org/clamav/clamav-0.97.2-1.el5.rf.x86_64.rpm
$ sudo wget http://pkgs.repoforge.org/clamav/clamav-db-0.97.2-1.el5.rf.x86_64.rpm

The following commands should install it.
$ sudo rpm -ivh clamav-0.97.2-1.el5.rf.x86_64.rpm
$ sudo rpm -ivh clamav-db-0.97.2-1.el5.rf.x86_64.rpm