SERVER MANAGEMENT
SERVER MANAGEMENT The Police department had purchased a server exclusively for the data integration of CIPA. For this purpose a rack mount server with specifications- as per annexure A was purchased through NICSI vide NICSI PO 100038/GEN/PN dated 19/4/2010. The server was delivered in May 2010 and installed in CRB in June 2010. Initially, this server was installed in CRB. A public IP(static IP),from BSNL, was provided for this server. But the server could not be provided 24 x 7 due to limitations in the infrastructure. Based on the request, it had been shifted to NIC on 23/6/2011. With the server positioned at NIC, the server is provided with 24 x 7 support. With the availability of SDC services, the server may be shifted on a co-located arrangement. The server configuration are finalized with the guidelines of Open Technology Centre, NIC,Chennai. The entire technical guidance on data replication is given by OTC, NIC,Chennai and NIC, Chennai. Requirements: 1. Ubuntu OS 10.04 Desktop Edition 2. httpd-2.2.16.tar.gz 3. JRE-6u21-linux-i586.bin 4. PostgreSQL 8.4.2.tar.gz 5. Symmetric-ds-1.7.6-bin 1. UBUNTU INSTALLATION Ubuntu is a computer operating system originally based on the Debian GNU/Linux distribution and distributed as free and open source software with additional proprietary software available. It is named after the Southern African ethical principle Ubuntu ("humanity towards others"). Ubuntu provides an up-to-date, stable operating system for the average user, with a strong focus on usability and ease of installation. Web statistics suggest that Ubuntu's share of Linux desktop usage is about 50%, and upward trending usage as a web server. It is composed of many software packages, of which the vast majority are distributed under a free software license (also known as open source). The main license used is the GNU General Public License (GNU GPL) which, along with the GNU Lesser General Public License (GNU LGPL), explicitly declares that users are free to run, copy, distribute, study, change, develop and improve the software. Ubuntu is sponsored by the UK-based company Canonical Ltd., owned by South African entrepreneur Mark Shuttleworth. By keeping Ubuntu free and open source, Canonical is able to utilize the talents of community developers in Ubuntu's constituent components.
Instead of selling Ubuntu for profit, Canonical creates revenue by selling technical support and from creating several services tied to Ubuntu. Download Ubuntu 10.04 Desktop Edition in the Ubuntu site itself. It is download free and download it as image file and write in the CD. First the put the Ubuntu OS CD in the system and restart the system, it starts from the CD. First select the Language as English and Then Install Ubuntu OS Again it asks for Language, select the Language as English. Select the Time Zone. Select the Keyboard method as USA Next is the Partition of the Hard disk as manual. / 10 gb Primary beginning /swap twice RAM Logical beginning /home 09 gb Logical beginning /data 30 gb Logical beginning /backup 30 gb Logical beginning (/data and /backup partition can be equally sized for any database backup, load balancing by running two instances etc). It ask for username and Password for the system. Then next simply press the forward button Finally Press the Install button. It takes 30 minutes to install the OS and after installation over it ask to restart the system. While restarting time it says to remove the CD and Press Enter. Finally it restarts the system and brings you the desktop of Ubuntu OS. 2. APACHE INSTALLATION Create admin user $ sudo adduser root admin $ sudo passwd root It ask for the password and we need to give the password for the root admin. Then type $ su It asks for the password and give the password, then it brings you the # prompt. Before installing the postgres and Apache we must check for compliers # gcc
type If it shows No input files, then the compilers are already installed. Otherwise # apt-get install g++ Download the latest version apache server in the site as mailed you already. Put the http2.2.tar file in the /usr/local/ and type this command. # tar xvzf http.2.2.tar.gz # cd httpd.2.2.16/ #./configure prefix=/usr/local/apache enable-shared-mods= all # make # make install To start and stop the apache service #./httpd k start #./httpd k stop 3. JRE INSTALLATION It is used to run the symmetric ds software, because the symmetric ds is written in java coding. Download the JRE -6u14.bin in the site as mailed you already. To install the jre, Open the root terminal or shell we need to copy the file to /usr/local. For example the file is in Desktop then u need to give this command # cp -fr /home/cip/desktop/ jre-6u14-linux-i586.bin /usr/local/ Then change the directory to /usr/local as # cd /usr/local/ then execute the file by #./ jre-6u14-linux-i586.bin After that it ask Do u want to continue? We want to give yes. Then it unpacks and install jre in the system. Rename the jre1.6... folder as jre. # mv jre1.6... jre Then we have to move the jre...bin file to the jre folder. # mv jre-6u14-linux-i586.bin jre1.6.04 4. POSTGRESQL INSTALLATION Download the PostgreSQL 8.4 in the site... PostgreSQL Downloading and compile the source code for installation
# tar xvzf postgresql-8.4.2.tar.gz # cd postgresql-8.4.2 #./configure --prefix=/usr/local/pgsql --without-zlib --without-readline # make # make install # cd contrib/ # make # make install # groupadd postgres # useradd -g postgres -d /usr/local/pgsql postgres # cd /usr/local/ # chown -R postgres:postgres pgsql To save the database, we make a directory in the other partition other than the OS. If OS corrupts, we can get the data without any loss after reinstalling the OS. # cd /data # mkdir PGDATA # cd.. # chown R postgres:postgres /data/pgdata We want to export the PATH where the data situated. For this, We want to edit the /etc/profile and at the bottom of this file add this lines, you need not set anywhere for any user. # cd /etc/ # vi profile Add these lines at the end of file. PG_HOME=/usr/local/pgsql export PG_HOME PATH=$PATH:$PG_HOME/bin export PATH To initialize the database as a postgres user # su postgres $ cd bin $./initdb U postgres D /data/pgdata To start and stop the PostgreSQL we need to use this command $ /usr/local/pgsql/bin $ vi startdb Add the line in the startdb file pg_ctl U postgres D /data/pgdata start Save and exit the file $vi stopdb Add the line in the stopdb file pg_ctl U postgres D /data/pgdata m fast stop
Save and exit the file Now change the permission of startdb and stopdb files $ chmod 777 startdb stopdb To run the database server $./startdb To stop the database server $./stopdb An instance with name CIPA will be created as follows. In this instance, all the stations can be appended whenever the station is configured. # su - postgres $ psql U postgres # create role cipa; # create database cipa; # alter database cipa owner to cipa; # \q $./createlang h localhost plpgsql cipa After that $ psql U postgres # [backslash] c cipa # [backslash] d At this stage, the database will be blank. It shows No relation found. Now the database is ready. 5. SYMMETRIC DS INSTALLATION Symmetric DS is asynchronous data replication software supporting multiple subscribers and bi-directional synchronization. It uses web and database technologies to replicate tables between relational databases in near real time. Download the Symmetric DS version 1.6 or 1.7 in the site as mailed you already. After download it extract the zip file you will find a folder with symmetric 1.6. In Symmetric DS we have 3 main folders: BIN LIB SAMPLES Rename the samples folder as Server in server machine. We want to edit the postgresql.xml file in the lib folder for the postgresql 8.0 version and for the other higher version of postgresql it does not bother about that. # vi postgresql.xml Replace /E with //
We want to edit the root.properties file in the server folder. # The class name for the JDBC Driver db.driver = org.postgresql.driver # The JDBC URL used to connect to the database db.url = jdbc:postgresql://localhost/dbname # The user to login as who can create and update tables db.user=postgres # The password for the user to login as db.password=postgres my.url=http://localhost:8090/sync Then rename the symmetric1.6 folder to symmetric. Then put the symmetric folder to root directory. # cp fr /home/cipa/desktop/symmetric /root Create the SymmetricDS tables in the root node database. These tables will contain the configuration for synchronization. The following command uses the auto-creation feature to create all the necessary SymmetricDS system tables. #../bin/sym -p root.properties --auto-create After give this command, check the database for the creation of sym tables in the database. If it does not create then edit the file postgresql.conf. # cd /data/pgdata # vi postgresql.conf Add the following line at the end of the file. custom_variable_classes= symmetric Load the sample data and configuration into the root node database. # vi insert_sample.sql Edit the file with the correct group id and external id of the server and also with the group id and external id of the client. It is used for replication of data between server and client. #../bin/sym -p root.properties --run-sql insert_sample.sql
To run the symmetric server we need to type this command in /root/symmetric/server #../bin/sym -p root.properties --port 8090 server Open registration for the client #../bin/sym p root.properties open-registration policestn,dnagar Here, the client is the server configured in Dhanvantri Nagar Police station. To take backup daily automatically in the server we must create a file Add the line Add the line # cd /backup/ # vi backup_data mv backup.sql backup-old.sql pg_dump U postgres cipa > /backup/backup.sql save the file and exit # crontab e 18 * * 0-6 /backup/backup_data Save the file and exit the file. The above back up will schedule the backup at 6.15 pm in the server and it stores in the backup directory. APPENDING ONE STATION DATA The appending of data taken as a backup (newins.sql) will be performed as follows: Put the newins.sql file in the /usr/local/pgsql/ # mv /home/cipa/desktop/newins.sql /usr/local/pgsql # su - postgres $ psql -U cipa cipa => [Reverse slash] i newins.sql It will append one station in the server backup. MIS on CIPA The server is installed with a web enabled application developed in PHP by NIC, Puducherry. The Web enabled application has various features including FIR online, Search FIR, Search by accused/complainant, Search Vehicle by Engine number/chassis number/registration number/color and comparison with RTO database, Analysis reports etc., The screen shots of the MIS are enclosed in Annexure B.