web analytics

Category Installations

Create local yum repo in Centos7

To create a local yum repo, all you need to do is to make sure the packages are available in a path in the server, say /downloaded_packages/

Now, create a repo file. Be default, all repo files are present in the path /etc/yum.repos.d/ . I am going to name my repo as local_yum, so I will create a repo file named local_yum.repo and add the following contents in it.

cat /etc/yum.repos.d/local_yum.repo

[local_yum]
name=local_yum
baseurl=file:///downloaded_packages/
gpgcheck=0
enabled=1

The above files tells the programme to take the packages from the baseurl mentioned in the file, which in our case is our local folder /downloaded_packages/

Now check if our repo is listed correctly. In my case, I have not set any other repos, so only my local repo is listed...

Read More

Install PHP7.2 on Centos7

PHP 7.2 does not come by default with Centos base repo. Hence, in order to install it we first need to install and enable the remi repo and then install PHP. Execute the following commands in the below order to get PHP 7.2 installed on Centos7.

[root@de56f5fc317d ~]# yum update

[root@de56f5fc317d ~]# yum install yum-utils

[root@de56f5fc317d ~]# yum install epel-release

[root@de56f5fc317d ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

[root@de56f5fc317d ~]# yum-config-manager –enable remi-php72

Now, check if PHP 7.2 packages are available.

[root@de56f5fc317d yum.repos.d]# yum list available php72
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: centos.mirrors.nublue.co.uk
* epel: lon.mirror.rackspace.com
* extras: mirror...

Read More

Install solr with jetty in Ubuntu

Solr is a search platform which is built on Apache Lucene. It makes search easier and faster. Solr can be installed along with tomcat or jetty. This post explains the installation based on jetty.

First you should install java and jetty as mentioned in the link here.

We will install solr also in /opt. First download the latest version of solr from https://archive.apache.org/dist/lucene/solr/

I am going to download version 4.10.4. Once downloaded, uncompress it and copy the war file from dist directory to jetty webapps folder.

[root@test ~]#cd /opt

[root@test ~]# wget https://archive.apache.org/dist/lucene/solr/4.10.4/solr-4.10.4.tgz

[root@test ~]# tar -xzvf solr-4.10.4.tgz

[root@test ~]#cp  solr-4.10.4/dist/solr-4.10.4.war   /opt/jetty/webapps/solr.war

Now, a few more files need to be ...

Read More

Installing Jetty in Ubuntu 14.04

Jetty is a java web server like tomcat, and java servlet container. This post describes how to install the latest version of Jetty in Ubuntu.

Latest version of Jetty can be downloaded from http://download.eclipse.org/jetty/stable-9/dist/

Jetty requires java and hence the first step is to install java. The latest version of Jetty, as of this writing is Jetty 9.3.8. Check the link here which shows what version of Java is required for the version of Jetty you are installing. If the version of Java does not match the version in which Jetty is compiled, then it will result in version conflict and Jetty will fail to start.

I am going to install Jetty 9.3.8, hence I need JVM 1.8. Login to your ubuntu machine and switch to root. Then issue the following commands to install java in the server.

[ro...

Read More

Hetzner server with > 2TB disk

Recently I ordered a Hetzner server for one of our clients. The server had two 3TB disks. Hetzner provides a command line installation of the desired OS once we login to their server. As such, I logged in to the server and installed Centos6 by executing “installimage” option as suggested by Hetzner.

After installing OS and rebooting the server, I noticed that the 3T disk is not showing full space.

[root@abc ~]#df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        99G  2.5G   91G   3% /
tmpfs           463M     0  463M   0% /dev/shm
/dev/sda2       976M  126M  800M  14% /boot

/dev/sda4   2.3T     123M   2.2T  1% /home

If the disk size is greater than 2T you cannot use normal fdisk to create partition...

Read More

ERROR: Error creating index db.collection-101613_nno.csv: 16633 err: “text search not enabled”

I was trying to restore a database onto a new server, when I got the following error.

mongorestore -d db /backup/db

ERROR: Error creating index db.collection-101613_nno.csv: 16633 err: “text search not enabled”

In order to correct this, you need to enabled text search. Simply stop the mongo process and start it with text search enabled.

root@abc# /etc/rc.d/init.d/mongod stop

root@abc# /usr/bin/mongod -f /etc/mongod.conf –setParameter textSearchEnabled=true

Now try restoring again and it works.

Read More

Adding domains under nginx

You can install nginx webserver as mentioned in this link

Now to add domains to it, we create two folders for the virtualhosts.

1) sites-available for all virtualhosts

2) sites-enabled for those virtualhosts that are active

We are going to create the domain greproot.com with username as greproot

The document root will be under /var/www/greproot/public_html. So create a user with home directory set to /var/www/greproot

[root@abc ~]# useradd -d /var/www/greproot  greproot

[root@abc ~]# passwd greproot                      # give a strong password for the user

[root@abc ~]# mkdir /var/www/greproot/public_html

[root@abc ~]# mkdir /var/www/greproot/logs

[root@abc ~]# touch /var/www/greproot/logs/access.log

[root@abc ~]# touch /var/www/greproot/logs/error.log

[root@abc ~]# chown -R...

Read More

Install nginx webserver in Centos6 server

You can install nginx webserver in Centos6 server with yum. It is simple and easy. Follow the steps given below.

First we need to install the nginx repo

[root@abc ~]# cd /etc/yum.repos.d/

[root@abc yum.repos.d]# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

[root@abc yum.repos.d]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

Make sure that the repo nginx.repo is listed at /etc/yum.repos.d. Once it is done, you can install nginx using yum

[root@abc yum.repos.d]# yum install nginx

The nginx configuration file is available at /etc/nginx/nginx.conf. You need to update the worker process in it. The worker process can be equal to the number of CPUs in the server.

[root@abc ~]# cat /proc/cpuinfo  | grep processor | wc -l

8

The above ...

Read More

Multpile sphinx instances in a single server using wordpress sphinx plugin

Not satisfied with the server sphinx instance? Need sphinx on your own? Try this.

Install wordpress and get the sphinx plugin from http://wordpress.org/plugins/wordpress-sphinx-plugin/


Go to your wordpress admin panel -> Plugins -> Add new -> Upload
Upload the zip file of the plugin you just downloaded
Click Install
Activate

Once the plugin is activated, you need to install and start searchd through wordpress.


Go to Wp Admin Panel -> Settings -> Sphinx Search -> Start Wizard
Enter the following details:
Host name or IP address – localhost
Port – 9312 will be enabled by default. Please note, if you already have a serverwide sphinx running, this will conflict. If so, change port to anything else. I used 9315.
Index name – leave as default
Install or use existing binaries – Since you need ...

Read More

Script to delete all messages from mailman archives

One of our customer wanted to delete all messages from mailman archives. He had around 101 mailing lists and hence manually deleting them was not possible. I wrote a small script to delete the contents and attachments  – and Bingo – all cleared !! :- )

Check out the script here

First I took the list details into a file called ss

cd   /usr/local/cpanel/3rdparty/mailman/archives/private

ls | grep abc.org | grep -v mbox > ss

For a given mailing list, the path “/usr/local/cpanel/3rdparty/mailman/archives/private” contains two folders namely listname_abc.org and listname_abc.org.mbox . listname_abc.org contains a folder called ‘attachments’ which contains the attachments and files of following three types.

2013-April 2013-April.txt 2013-April.txt.gz

Our intent is to delete all such files a...

Read More