Steps to Kill a Process in Linux/Unix

A computer process refers to a computer program having a unique process identification or also called as PID. Basically, on the Linux operating system, a process may be running in the background, foreground or may be in a suspended state. It might possible that on Linux, the OS shell may not return the prompt to the end-user unless the current process that is running is finished. As a result, many processes that take a substantial amount of time to execute and keep you from utilizing the console until the process is finished running.

The most common issue that arises for Linux users is to kill or background a process so that other tasks are conducted on the system. In order to kill a process a signal has to be sent using the Linux kill command.

How to kill a linux process using “kill” command?

Step One: Enter the below linux command to get the PID for the running process on your system which you want to kill.

ps myProcess

Once you enter the above command it will return with something similar to the following:

PID TTY TIME CMD
1234 dz07 0:50 edit myBook
1235 dz07 0:47 -csh

Step Two: Enter the following linux kill command to terminate the first process mentioned in the example above:

kill -1 1234

Enter the following command to terminate the second active process:

kill -1 1235

Step Three: It is possible that the kill -1 does not work, in such a case, you will need to use the -9 argument to clear the process from your system. Use the following command:

kill -9 1234
kill -9 1235

Step Four: Instead you can also kill all the instances of a given process by using the killall command. Enter as shown below:

killall <pname>

<pname> refer to the process name.

This tutorial is applicable only on VPS or a Dedicated Server, as it requires root access to the server.

How to Use sudo to Assign Root Access to a User on a Linux Server

Using sudo to Assign Root Access to a User on a Linux Server

Attimes you are required to offer Root access for a particular account having limited privileges on a server. You must follow the below steps to assign Root Access to a particular user using sudo.

Step 1 : Login to the server as root.

Step 2 : Run the following command :

root@host [~]# visudo

Step 3 : The screen displayed would be of the sudoers file in the vi editor. You must include the belwow line into this file to assign complete root privileges to an account (in our case it is accountname).:

accountname ALL=(ALL) ALL

Step 4 : If you do not intend to offer the complete access but be able to run a particular list of commands, you may create a command alias in your sudoers file, for example:

User_Alias ADMINS = accountname
Cmnd_Alias HTTPD = /etc/init.d/httpd
ADMINS ALL = HTTPD

With this, you should be able to create a group of users whom you can then assign command aliases to. You only need to ensure that the users are separated using a comma (,).

The Cmnd_Alias would show you a list of different commands that the users of a particular Alias can run. You may then choose the user alias and assign the command alias.

The above would ask the user to enter his/er password each time sudo is run. Though if don’t want the system to ask for a password each time, you may replace ADMINS ALL = HTTPD in the last line with the following :

ADMINS ALL = NOPASSWD: HTTPD

Incase you need any assistance with this, please contact our support department via. 24×7 Live Chat available at www.eukhost.com

Affordable web hosting

How to Fix cPanel Error: Sorry, that domain is already setup (remove it from httpd.conf?)

It may be possible that you may come across an issue of adding a domain via WHM create account function and get the following error:

Sorry, that domain is already setup (remove it from httpd.conf)

Getting the above error simply means that the domain still exists in the virtualhost in apache configuration file known as httpd.conf . There are two main reasons why it has shown you this error.

Reason One:

It might be possible that the domain you are trying to create is being used as a primary domain for one of the accounts or may be it has been used as an addon domain or parked for other domains and accounts.

Reason Two:

Or it may be possible that you are facing some technical issues such as the addon, parked or the primary domain is not removed completely from the system after using the removing function.

If the error is due to the first reason, you can easily remove the domain name from the cPanel account and even if it is not removed and come up with the following error:

Error from park wrapper: Sorry, you do not control the domain

Follow the steps given below:

First you should find out who owns the domain, enter the following command:

/scripts/whoowns example.com

Even if it didn’t show any results, enter the following command string:

grep example.com /var/cpanel/users/*

You will get the result something like the following:

root@server [~]# grep example.com /var/cpanel/users/*
/var/cpanel/users/exam:XDNS1=example.com

As you can see, we could easily find the owner of the domain (example.com), the next step is to edit the following files with the corresponding user and remove the lines associated with the domain (example.com) you have problem with.

/var/named/example.com.db
Remove the virtualhost for example.com from /etc/httpd/conf/httpd.conf
/var/cpanel/users/username [remove entries related to domain]
/etc/userdomains
/etc/localdomains
vim /etc/named.conf [remove entries related to domain]
Remove DNS entry in WHM
Run /scripts/updateuserdomains as root on the server

That’s it!

cPanel Web Hosting

How to Backup and Restore Individual cPanel Account via SSH

Backing up your hosting account is very necessary for your business to survive on Internet. Whether it is a small or large business, you must backup all of your data regularly at least once a week. cPanel provides some great ready made scripts which will help you make your tasks more easy. Commands such as pkgacct is basically used for backing up cpanel web hosting accounts and restorepkg for restoring cpanel accounts via the SSH or command line interface.

How to create backup of Individual cPanel Account via SSH?

Step 1: Log-in to the SSH as Root user.

Step 2: Enter the following command string on the command line interface:

/scripts/pkgacct username

[Note: The account backup will be created in the current directory you are in.]

How to Restore the Individual cPanel Account via SSH?

Step 1: To restore the cPanel account backups, enter the following command

/scripts/restorepkg username

[Note: In order to restore the data, you need to be in the directory where the backup file is stored.]

This is the easiest way to backup and restore individual cPanel web hosting accounts via command line interface.

Steps to Copy a MySQL table with phpMyAdmin Explained

The article would help you with a step-by-step procedure about how to copy a table with phpMyAdmin located within the cPanel control panel.

Step 1 : Log into cPanel

Step 2 : Go to phpMyAdmin and choose the database and the table that you intend to copy

Step 3 : Go to the option titled “Operations” listed amongst the other tabs

Step 4 : Locate the box titled “Copy table to (database,table):

Step 5 : There are two options you may choose from ie. either create a copy of the table to the current database (usually gets selected by default) OR copy the table to a different database

Step 6 : Choose the database name from the drop-box and the name of the table to copy the structure and / or data into.

You are required to choose between the following options before proceeding any further :

  • Structure only – Selecting this option would only create a copy of the table and its name. You must note that the data wouldn’t be copied in this case.
  • Structure and data – Choosing this option would allow you to copy the table along-with its name, but would also copy the data it contains to the destination you choose further in the process ie. INSERT INTO >> SELECT * FROM …
  • Data only – Clicking the radio button would only copy the data to the destination.

Furthermore, you are offered the option to choose whether you wish to drop the table that you are copying to before creating the table and copying the data. This runs a DROP TABLE IF EXISTS query for the copy of the table, not the original. You would not notice any change if you’ve chosen data only copy.

Then you’d have the option to choose to copy the auto increment value. This isn’t a default function, and you’d need to check it manually. The auto increment value will end up being whatever it would be after the INSERT INTO query is done. Checking the box would activate the CREATE TABLE syntax which would then include the auto increment value from the original table.

Lastly, you can see the option termed “Switch to copied table ”, as the title suggests you’d be switched over to the copied table once the queries are completed. If you leave it unchecked, the resulting page will still be looking at the original table; if checked it will change to the copied database (if applicable) and table.

Cheap Web Hosting UK

httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName | Solved

The ‘yum’ package manager can be used to Install the apache web server on an Fedora web server. Known for it flexibility and stability, Apache is considered to be one of the highly popular and widely used web-servers in the Industry. There isn’t a web server that hosts more websites than what Apache does. Moreover, finding support for it is just meters away, one can find a number of tutorials on this topic over the World Wide Web.
The information offered below would help users understand the steps to get rid of the warning :

httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

To initiate the the process, we’d first check the IpTables

You need to be careful with the primary step ie. before you install a web server. This is to ensure that browser is capable of reaching it.

Usually, if you have a firewall running on a server, it may carry out its task of blocking traffic to ports 80 and 443 which are usually used for regular and secure connections respectively. So, you must first check the firewall rules using the below command :

sudo /sbin/iptables -L

Check whether the ports 80 and 443 are open. Well, if you do not have a firewall installed on a server yet, there is no question of making any changes to it.

If you find that the ports are closed the following rules should be set in iptables configuration:

iptables -I INPUT -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp –sport 80 -m state –state ESTABLISHED -j ACCEPT
iptables -I INPUT -p tcp –dport 443 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp –sport 443 -m state –state ESTABLISHED -j ACCEPT

How to Install Apache on Fedora ?

The procedure to Install a basic apache is simple, use the following command for the same :

sudo yum install httpd mod_ssl

This command would install apache and couple other packages to support few of the required option.

Setting the ServerName

You may probably encounter a warning such as “httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName”. Such a warning is usually shown by “httpd” as it is a default name of an apache process when it’s running, therefore you must look for in a ps list or top.

To get past this warning you are first of all required to create a “custom” directory in apache’s configuration directory. The following command should help you do that :

sudo mkdir /etc/httpd/conf/custom

Now create a config file to store your server name:

sudo nano /etc/httpd/conf/custom/preferredserver_name.conf

You must now include the below line into the servername.conf file

ServerName preferredserver_name

NOTE : You must replace the “preferredserver_name” with the name of your choice. Make sure that you do not use domain name as we’d be using it to create virtual hosts later.

Then, you must save the file.

Now, make amendments to the the main apache config file, use the following command to access it:

sudo nano /etc/httpd/conf/httpd.conf

Scroll down to the end and insert the below code:

Include /etc/httpd/conf/custom/*.conf

Save the changes made to httpd.conf.

This completes the installation of apache.

Use the below command to start automatically upon reboot.

sudo /sbin/chkconfig httpd on

Make sure that the ServerName is included in the httpd.conf file and the host name is correctly specified:

hostname preferredserver_name

Once the server is Rebooted, you shouldn’t see the Warning message again.

Cloud Servers in the UK

How to Start, Stop and Restart Services on Linux Dedicated Server

Generally, in Linux dedicated servers, there are two different kind of programs running, one which needs user interaction and another which execute tasks without user involvement. The programs that execute tasks in the background are normally known as “services” and “daemons”.

Basically, there are many services required on servers to run the background such as DB Server, Firewall, Web Server, DNS System, Mail Server, etc… Due to these various services, it is very much essential to know the exact procedure of starting, stopping and restarting the services.

The procedure of start, stop and restart the services may change as per the linux distributions. Here in this article we are going to see how to start, stop and restart services in CentOS Dedicated Server.

There are two different methods through which you can start, stop and restart any desired service:

How to Start a Service?

First Method:
/etc/init.d/service-name start

Second Method:
service service-name start

How to Stop a service?

First Method:
/etc/init.d/service-name stop

Second Method:
service service-name stop

How to Check the Status of a Service: (whether it is running or not)

First Method:
/etc/init.d/service-name status

Second Method:
service service-name status

How to restart a service on dedicated server?

First Method:
/etc/init.d/service-name restart

Second Method:
service service-name restart

It might be possible that few services may have extra command settings. To find the available ones, enter:

First Method:
/etc/init.d/rsync [start, stop, reload, force-reload, restart, status]

Second Method:
service rsync

Using Yum Commands to Disable and Remove Package Repositories on CentOS

YUM also called as Yellowdog Updater, Modified is a default package management system which is mostly used in all versions of CentOS to install and update packages and repositories. With the help of “yum” a user can maintain their OS and applications updates very easily. In this tutorial, we are going to see how to disable and remove package repositories on CentOS using yum.

Disabling a Package Repository

Usually, the package repositories are located in the definition files, which can be found in the directory named /etc/yum.repos.d . In order to disable the file, you need to modify the proper file and set the below given parameter.

enable = 0

The above parameter will keep the repository, however it will disable it until you decide to use it in future.

Removing the Repository Completely

If you wish to remove the repository completely, simply delete the aforesaid file.

How to Clear the YUM Cache?

Generally, when a package is downloaded, installed and then it is removed there is a possibility that the package may still be memorized in the yum’s cache. In order to clean all the cached packages from the enabled repository cache directory, enter as root:

yum clean packages

In addition to that, to purge the old package information completely, simply run the following command.

yum clean headers

To clean any cached xml metadata from any enabled repository, enter:

yum clean metadata

If you wish to clean all the cached files from any enabled repository at once, enter:

yum clean all

To make sure that YUM has fresh data and functions perfectly all the time, you should “clean” it on a regular basis.

cPanel Web Hosting

Start, Stop and Configure Time Sync for a Cloud VM

How to Configure Time Sync for a Cloud VM ?

The following are the steps to configure Time Sync for VM’s in Cloud. This should enable administrators to synchronise the time by the node despite rebooting of the server.

How to Configure Time Sync for Linux ?

Step 1 : Log into the server via SSH as administrator
Step 2 : Use the following command in the command prompt :

vmware-guestd –cmd “vmx.set_option synctime 0 1″

How to Configure Time Sync for Cloud Hosting Platform using Windows 2008 R2  ?

Step 1 : Access the server using RDP – Remote Desktop Protocol (Make sure you have administrator rights on the server)
Step 2 : Go to the command prompt.
Step 3 : Use the following command:

w32tm /config /manualpeerlist:pool.ntp.org,0×8 /syncfromflags:MANUAL
net stop w32time
net start w32time

Since its a VM withing Hyper-V, one must disable time sync by going to VM settings >> Management >> Integration Services >> uncheck Time Synchronization.

Step 4 : Check if the VM syncs the time on reboot, use the below command for that:

schtasks /create /tn TimeSync /tr “w32tm /resync” /sc onstart

Step 5 : You might be prompted to enter your username and password to re-establish connection for Remote Desktop.

Some might receive an error trying to sync time, for example : “RPC Server is Unavailable”, you should use the following to troubleshoot :

A. Use the following command to Stop the Windows Time Service (WTS) :

net stop W32Time

B. Use the below command to Unregister the WTS :

w32tm /unregister

C. Following is the command that would help you re-register the WTS :

w32tm /register

Note: You might at times be required to reboot the server before re-registering the service.

D : Re-initiate the WTS and ensure that the service is running well, use the following command for the same:

net start W32Time sc query W32Time

Cloud Hosting Servers

Site contains both Secure or Non-secure items – SSL Errors

How to resolve the issue stating “Site contains both Secure or Non-secure items ” ?

The SSL Certificate issued by Eukhost limited for your domain is capable to cover the entire domain. But if a site consists of images, hyperlinks etc. that aren’t covered under a secure connection ie. has a URL that doesn’t start with https://, then the web-browsers would probably show such a warning message stating “Your website contains both secure and non-secure items.”

In such a case, you must check website codes for any external links that aren’t pointing to locations other that an https.

SSL Certificate

« Previous entries Next Page » Next Page »