Saturday, January 31, 2015

CentOS 7 PostgreSQL 9.2 install

Here's what I did to install PostgreSQL on a CentOS 7 box.  As root:

yum -y install postgresql postresql-server postgresql-contrib postgresql-libs

Optionally, install pgAdmin III with:
yum -y install pgadmin3

Configure initial database structure:
postgresql-setup initdb

Configure PostgreSQL to listen on all IPs by editing /var/lib/pgsql/data/postgresql.conf.  Change listen_addresses = '*'

Start the server:
systemctl start postgresql

Check that the service is listening:
netstat -antup | grep 5432

Modify /var/lib/pgsql/data/pg_hba.conf to allow md5

## IPv4 local connections:
host    all             all             127.0.0.1/32            md5 
# IPv6 local connections:
host    all             all             ::1/128                 md5 

As the user postgres reload configuration:
su - postgres
pg_ctl reload

As postgres, create a test database and an administrative user:
createdb test
psql test
CREATE USER root WITH SUPERUSER LOGIN PASSWORD 'password';
\q

As root, configure PostgreSQL to start with the system:
systemctl enable postgresql


.ssh permissions on a *nix box

Mostly to remind myself...set .ssh permissions on a *nix box.  From ~:

chmod 700 .ssh
chmod 644 .ssh/id_rsa.pub
chmod 600 .ssh/id_rsa

End result is:

  • .ssh directory is (drwx------)
  • public key (.pub file) is (-rw-r--r--)
  • private key (id_rsa) is (-rw-------)

That's better.


Friday, January 2, 2015

Build libsdl2-dev deb package for Raspbian on Raspberry Pi

Some projects I want to experiment with require Simple DirectMedia Layer (SDL) version 2 for Raspbian on a Raspberry Pi.  Unfortunately, the debian package for libsdl2-dev is not currently included in Raspian Repository.  Jan Zumwalt described how to build libsdl in his post titled "How To Install & Use SDL2 on Raspbian PI".  I prefer to install software via package managers when possible so I decided to make a .deb for libsdl2-dev.

Install devscripts
sudo apt-get install devscripts

Download libsdl 2.0.  I used SDL2-2.0.3.tar.gz.  Then follow the IntroDebianPackaging guide.

rename the SDL2-2.0.3.tar.gz to SDL2_2.0.3.tar.gz
extract the tar.gz
All the necessary files for building a .deb are already in the debian folder

Run debuild
debuild -uc -us

Install missing build dependencies
sudo apt-get dh-autoreconf libpulse-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev

Run debuild again
debuild -uc -us

Install packages
sudo dpkg -i libsdl2_2.0.3_armhf.deb
sudo dpkg -i libsdl2-dev_2.0.3_armhf.deb