Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

Monday, July 22, 2013

Installing Qt 5.1 on a virtual CentOs 6.4 server

1. Get the latest VirtualBox software from https://www.virtualbox.org/wiki/Downloads

2. Get CentOS 6.4 DVDs or ISO files from the Internet, e.g.here:
http://mirrors.usc.edu/pub/linux/distributions/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD1.iso and here http://mirrors.usc.edu/pub/linux/distributions/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD2.iso

Install CentOS VM with 4-5GB RAM, 4-6 CPUs and 40GB HD.

System->Administartion->Software Update - install the updates
Devices->Install Guest Additions
System->Preferences-Screen Saver: unselect "Activate when idle"

Restart the VM


#If the VM HD needed to be later resized
#>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd
#"C:\Users\david_000\VirtualBox VMs\AdEx2 CentOS 6.4_ QT 5.1\AdEx2 CentOS 6.4_ QT 5.1.vdi" --resize 32768

3. Build the latest GCC from the sources, e.g. from http://gcc.cybermirror.org/releases/gcc-4.8.1
mkdir ~/tmp
cd ~/tmp

tar -jxvf ~/Downloads/gcc-4.8.1.tar.bz2

cd gcc-4.8.1
./contrib/download_prerequisites
mkdir gcc-build
cd gcc-build
sudo ../configure --disable-multilib
sudo make
sudo make install



4. Edit ~/.bash_profile adding there

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
export LD_LIBRARY_PATH


#save & close the file, init the environment in your terminal
source ~/.bash_profile


5. Download Qt
su

#install missing gstreamer packages, if any
yum install 'pkgconfig(gstreamer-app-0.10)'


mkdir /tmp/qt
cd /tmp/qt
wget http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz

# for QT 5.2: wget http://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.tar.gz

tar -xvf qt-everywhere-opensource-src-4.8.5.tar.gz
cd qt-everywhere-opensource-src-4.8.5
#For Qt 4.8.5:  ./configure
#For Qt5.x:  ./configure -qt-xcb
make
make install

#If your shell is bash, ksh, zsh or sh modify ~/.profile file adding:
PATH=/usr/local/Trolltech/Qt-4.8.5/bin:$PATH
export PATH

LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.8.5/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH


#in case your shell is csh or tcsh modify ~/.login adding:
setenv PATH /usr/local/Trolltech/Qt-4.8.5/bin:$PATH


4. Install the new virtual machine with CentOS 6.4, select "Minimal Desktop" / RedHat in VirtualBox settings, 4GB RAM
  -- VirtualBox->Devices -> Shared Clipboard -> Bidirectional
  -- VirtualBox->Devices ->Drag-n-Drop-> Bidirectional
  -- VirtualBox->Devices->Install Guest Additions
  -- Network->eth0->connect automatically
  -- System->Preferences->Screensaver - unselect "Auto"


5. Create a new user and add him to sudoers (visudoers as root). Also add
Defaults: root !requirestty
Defaults:your-new-user !requirestty


7. Install QtCreator if required.
cd ~/Qt

# QtCreator 2.8 fails with Segmentation fault  (core dumped) error
# wget http://download.qt-project.org/official_releases/qtcreator/2.8/2.8.0/qt-creator-2.8.0-src.tar.gz
# gzip -d qt-creator-2.8.0-src.tar.gz
# tar -xvf qt-creator-2.8.0-src.tar
# cd  qt-creator-2.8.0-src

# using 2.7.0 instead of failing 2.8.0

wget http://origin.releases.qt-project.org/qtcreator/2.7.0/qt-creator-2.7.0-src.tar.gz
gzip -d  qt-creator-2.7.0-src.tar.gz
tar -xvf qt-creator-2.7.0-src.tar
cd qt-creator-2.7.0-src


sudo /usr/local/Qt-5.1.0/bin/qmake qtcreator.pro

# if an error occures:
# error: dereferencing pointer ‘’ does break strict-aliasing rules
# Then edit corresponding Makefile removing "strict" flag (the build fails otherwise)

# Open in an editor and remove "-Werror" in CXXFLAGS variable
# vi /home/bis/Qt/qt-creator-2.8.0-src/src/shared/qbs/src/lib/Makefile


sudo gmake
sudo gmake install

#check install:
which qtcreator

#should return
/bin/qtcreator

Saturday, December 08, 2012

How To Install ffmpeg on CentOs 6.x (6.3)

I installed ffmpeg on a dedicated CenOs 6.3 server. The installation mostly follows the instrcutions given by the eFFMPEG group here, but there are few important twists if you want to get it done.

1. Login as root

2.Pre-set:
# remove older installations
yum erase ffmpeg x264 x264-devel
 
#verify you get all teh tools:
yum install gcc git make nasm pkgconfig wget
 
#create a working folder
mkdir ~/ffmpeg-source
 
3. Installations
 
#install yam 
cd ~/ffmpeg-source
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
 
#install x264
cd ~/ffmpeg-source
git clone git://git.videolan.org/x264
cd x264
./configure --enable-static
make
make install
 
#install mp3 encoder
cd ~/ffmpeg-source
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --disable-shared --enable-nasm
make
make install 

#install libogg
cd ~/ffmpeg-source
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar xzvf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure --disable-shared
make
make install
 
#install libvorbis
cd ~/ffmpeg-source
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar xzvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure --disable-shared
make
make install 

#install libvpx
cd ~/ffmpeg-source
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure
make
make install
 
#install zlib
cd ~/ffmpeg-source
wget http://zlib.net/zlib-1.2.7.tar.gz
tar xzvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make
make install 

#FFMPEG did not want to work well in /tmp
mkdir ~/tmp
export TMPDIR=~/tmp

#you might also need to add to PATH /usr/lib
export PATH=$PATH:/usr/lib

#and probably add (I did it, but not sure it is a must)
export LD_LIBRARY_PATH=/usr/local/lib

#now install ffmeg from GIT repository
cd ~/ffmpeg-source
git clone git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264
make
make install
 
#this should work now! type 'ffmpeg' to try
ffmpeg
ffmpeg version N-47639-g0110108 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec  8 2012 22:03:48 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 79.100 / 54. 79.100
  libavformat    54. 48.100 / 54. 48.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 26.100 /  3. 26.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg' 

Thursday, August 30, 2012

Installing RIAK on RedHat Linux CentOS 6


# The official guide is here: http://wiki.basho.com/Installing-on-RHEL-and-CentOS.html#From-source

# get superuser permissions: login as root

 # for CentOS 6 (64-bit) and RIAK 1.2.0.1 -
wget http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/CURRENT/rhel/6/riak-1.2.0-1.el6.x86_64.rpm
sudo rpm -Uvh riak-1.2.0-1.el6.x86_64.rpm 

# next, edit config file adding external server' IP next to internal 127.0.0.1 wherever appropriate
# For HTTP / HTTPS the lines should look like
#
#  {http, [ {"127.0.0.1", 8098 }, {"222.222.8.155", 8098} ]},
# and
# {https, [{ "127.0.0.1", 8098 }, {"222.222.8.155", 8098}]},

vi /etc/riak/app.config

#next, start RIAK instance

riak start


# to test your install put some JPEG file into RIAK

curl -X PUT HTTP://127.0.0.1:8098/riak/images/1.jpg   -H "Content-type: image/jpeg" --data-binary @./u.jpg

# check you can see from outside of RIAK machine by using a browser with link to
http://[external-IP-or-domain-for-RIAK-machine]:8098/riak/images.1.jpg


Thursday, July 12, 2012

Clustering RabbitMQ on CentOS 6

#Assuming you got to instances of RabbitMQ installed on two separate computers in the same LAN segment, run the following command on both nodes (A and B):

rabbitmqctl status

# verify that both RabbitMQ nodes run EXACTLY the same Erlang version
# if they do not - upgrade Erlang on one of them to match the second Erlang version
# at the beginning of its layout the command displays RabbitMQ node name, e.g. rabbit@my-server-A - note this node name for the later use

# Check that both machines A and B can talk to each other (no firewall issues etc)

telnet localhost 4369


# Let's work on server A configuring RabbitMQ there to be clustered with server B.
# all the work is done on server A only, nothing should be done on server B

# stop rabbitmq service on server A

service rabbitmq-server stop



# add alias for B an A:
vi /etc/hosts

# add to /etc/hosts the alias of server B like it is displayed in the "rabbitmqctl status" output after "@" symbol, e.g. "10.10.10.10   my-server-B"
# use internal IP for server B alias if you got such, so the connection between serves A and B will go over internal switch

# copy Erlang cookie from the server B to the server  A:
scp root@my-server-B:/var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie

# give the cookie file the correct ownership (comes with 'root' after copying)
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie

# start rabbitmq service
service rabbitmq-server start

#stop and reset the app
rabbitmqctl stop_app

rabbitmqctl reset

# cluster the current node (on server A) to the node on server B as a disk node
#(if you prefer to cluster node A to B as RAM node run       rabbitmqctl cluster rabbit@my-server-B)

rabbitmqctl cluster rabbit@my-server-B rabbit@my-server-A

# you should see the success message here

# start the app and enjoy
rabbitmqctl start_app

#verify that two nodes are indeed clustered: use management plugin
# go to server A, HTTP on port 55672
# you should see "node" column in the Queues view, filled in with 'my-server-B' node name










Saturday, June 23, 2012

Determine filesystem on Linux

df -T [device]
NOTE: for partitioned FS we should look for [device1], [device2] etc - e.g. /dev/sdf1, /dev/sdf2 (/dev/sdf FS type could be unknown in this case)
http://www.cyberciti.biz/faq/linux-how-to-determine-find-out-file-system-type/

Wednesday, May 16, 2012

Adding swap space on CentOS

# login as root with
su -

# not '-' sign - important!

#allocate file: 20 GB = 20 * 1024 * 1024
dd if=/dev/zero of=/swapfile bs=1024 count=20971520

mkswap /swapfile

#set permissions:
chown root:root /swapfile
chmod 0600 /swapfile

#add immediately to OS
swapon /swapfile

# edit fstab for persistence:
vi /etc/fstab

# edit fstab by adding the following line at the end of the file:
/swapfile /swap swap defaults 0 0

# check if the swap is allocated
free -m

Wednesday, April 11, 2012

sudo: Sorry, you must have a tty to run sudo (SOLVED)

I found that running a cron job on CentOS I am getting an error:
sudo: Sorry, you must have a tty to run sudo
the script, running not as a root user was using a sudo command.

Some googling showed that this is what I need (run sudo visudo to edit the config file):
Defaults requiretty
Defaults:root !requiretty
Defaults:myusername !requiretty


Thus the default remains "requiretty" for everyone but for the named users.

Sunday, March 25, 2012

Installing RabbitMQ on CentOS, Fedora and RHEL

# Login as root. Note "-" in su command, it is important to get proper shell definitions including the PATH
su -
....enter password


#verify OS version
cat /etc/*release*

# Download and enable EPEL
# for CentOS 5:

# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

# for CentOS 6:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm 


#Get & install Erlang
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter
/erlang/epel-erlang.repo

yum install erlang

# Get RabbitMQ signing key
rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc

# check for the latest version at RabbitMQ web site: http://www.rabbitmq.com/install-rpm.html
rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.4/rabbitmq-server-2.8.4-1.noarch.rpm

yum install rabbitmq-server-2.8.4-1.noarch.rpm

# if this command did not work take a look what you got in online repositories:
# http://repos.fedorapeople.org/repos/peter/erlang/
# probably your RPM does not exists there
# in this case you can try using older RPM
# if you decided to do that, do teh following:
vi /etc/yum.repos.d/epel-erlang.repo

#comment line
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-$releasever/$basearch/

# and replace it with
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-5/$basearch/


# next, comment line
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-$releasever/SRPMS

# and replace it with
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-5/SRPMS

# exit vi and try again running
# yum install rabbitmq-server-2.8.4-1.noarch.rpm

# Add RabbitMQ to list of services to be started on reboot
chkconfig rabbitmq-server on

# Add RabbitMQ management plugin:
/usr/sbin/rabbitmq-plugins enable rabbitmq_management sudo

# start RabbitMQ server

service rabbitmq-server start


# point your browser to  http://[your-rabbitmq-server]:55672
# enter user name / pwd: the defaults are guest / guest

Thursday, June 30, 2011

Installing MYSQL on RedHat Enterprise Linux RHEL 6.1

Get MySQL here: http://www.mysql.com/downloads/mysql/#downloads


Select TAR installation if available, get the link of TAR and run
wget [link]

Uncompress
 tar -xvf MySQL-5.5.13-1.rhel5.x86_64.tar


Install server:
rpm -Uvh MySQL-server-5.5.13-1.rhel5.x86_64.rpm

Install client:
rpm -Uvh MySQL-client-5.5.13-1.rhel5.x86_64.rpm


Note this warning:
----------------------
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h ip-10-34-70-147 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

-----------------------------------

Start MySQL:
service mysql start