Monday, 23 October 2017

Unoconv Installation.

"unoconv" is a command line program that is used to convert between different office document file formats. It uses an instance of LibreOffice to do the conversion 

The steps required to install unoconv are different depending on the operating system that you have installed Moodle on. 
CentOS / RedHat

Just before you start, you might like to consider installing the latest LibreOffice. Before installing, please remove any openoffice packages you might have on your OS by issuing:

yum remove openoffice* libreoffice*

And then follow the install instructions LibreOffice 5.2. It is recommended to chose your localized libreoffice version for better document conversions.



Then, 

git clone https://github.com/dagwieers/unoconv.git # copy cp unoconv/unoconv /usr/bin # or link unoconv to /usr/bin ln -s unoconv/unoconv /usr/bin/unoconv


Create a new init file: "vim /etc/init.d/unoconvd"

#!/bin/sh ### BEGIN INIT INFO # Provides: # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO   #UNO_PATH=/opt/libreoffice5.2/program unoconv --listener   dir="/opt/libreoffice5.2/program" #cmd="/usr/bin/unoconv -vvv --listener &" cmd="/usr/bin/unoconv --listener" user="root"   name=`basename $0` pid_file="/var/run/$name.pid" stdout_log="/var/log/$name.log" stderr_log="/var/log/$name.err"   get_pid() { cat "$pid_file" }   is_running() { [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 }   case "$1" in start) if is_running; then echo "Already started" else echo "Starting $name" cd "$dir" if [ -z "$user" ]; then sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & else sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & fi echo $! > "$pid_file" if ! is_running; then echo "Unable to start, see $stdout_log and $stderr_log" exit 1 fi fi  ;; stop) if is_running; then echo -n "Stopping $name.." kill `get_pid` killall soffice.bin for i in {1..10} do if ! is_running; then break fi   echo -n "." sleep 1 done echo   if is_running; then echo "Not stopped; may still be shutting down or shutdown may have failed" exit 1 else echo "Stopped" if [ -f "$pid_file" ]; then rm "$pid_file" fi fi else echo "Not running" fi  ;; restart) $0 stop if is_running; then echo "Unable to stop, will not attempt to start" exit 1 fi $0 start  ;; status) if is_running; then echo "Running" else echo "Stopped" exit 1 fi  ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1  ;; esac   exit 0


And please make sure to change the libreoffice5.2 path in the script.

chmod 755 /etc/init.d/unoconvd
chkconfig --add unoconvd
chkconfig --level 235 unoconvd on
/etc/init.d/unoconvd status
/etc/init.d/unoconvd start
 
Source Ref: 
 
https://docs.moodle.org/32/en/Universal_Office_Converter_(unoconv)
https://docs.moodle.org/32/en/mod/assign/feedback/editpdf/testunoconv/initdcentos6

Monday, 5 May 2014

DBXML Installation Stpes for Linux

Note : DBXML will not work with PHP 5.3 or higher. Require PHP 5.2 or older version in order to install
DBXML
Last release of DBXML was on - December 22, 2009


http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html

Download and extract dbxml-2.5.16 to /usr/local/src/

cd /usr/local/src
wget http://download.oracle.com/otn/berkeley-db/dbxml-2.5.16.tar.gz
tar xzf dbxml-2.5.16.tar.gz
cd /usr/local/src/dbxml-2.5.16
./buildall.sh


cd /usr/local/src/dbxml-2.5.16/db-4.8.26/php_db4
phpize
./configure --with-db4=/usr/local/src/dbxml-2.5.16/install/
make
make test
make install


cd /usr/local/src/dbxml-2.5.16/dbxml/src/php/
phpize
./configure -with-berkeleydb=/usr/local/src/dbxml-2.5.16/install/
make
make test
make install


Add extensions in php.ini and restart the web server
vi /etc/php.ini
extension=db4.so
extension=dbxml.so
service httpd restart


Testing
check phpinfo page, you can find the below lines in phpinfo page
db4
db4 support enabled
dbxml
dbxml supportenabled
dbxml version Oracle: Berkeley DB XML 2.5.16: (December 22, 2009)


Monday, 3 February 2014

Wowza Media Server Installation in Linux


Wowza Media Server is a high-performance streaming media server.

Download the Latest version from the official website of wowza or use wget to download the software.
http://www.wowza.com/pricing/installer 

[root@localhost src]# wget http://www.wowza.com/downloads/WowzaMediaServer-3-6-2/WowzaMediaServer-3.6.2.rpm.bin
--2014-02-03 05:58:27--  http://www.wowza.com/downloads/WowzaMediaServer-3-6-2/WowzaMediaServer-3.6.2.rpm.bin
Resolving www.wowza.com... 96.30.11.104
Connecting to www.wowza.com|96.30.11.104|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 77650236 (74M) [application/octet-stream]
Saving to: `WowzaMediaServer-3.6.2.rpm.bin'

100%[===================================================================================>] 77,650,236  78.9K/s   in 16m 51s

2014-02-03 06:15:20 (75.0 KB/s) - `WowzaMediaServer-3.6.2.rpm.bin' saved [77650236/77650236]

[root@localhost src]# ll
total 75916
-rw-r--r-- 1 root root 77650236 Jun  9  2013 WowzaMediaServer-3.6.2.rpm.bin

Then, grant execute permission to the file.

[root@localhost src]# chmod +x  WowzaMediaServer-3.6.2.rpm.bin

Then start to install and accept the  license tems.

[root@localhost src]# ./WowzaMediaServer-3.6.2.rpm.bin
WOWZA MEDIA SOFTWARE
END USER LICENSE AGREEMENT ("EULA") VERSION 3.6

NOTICE: BY DOWNLOADING, INSTALLING, COPYING OR

Do you agree to the above license terms? [yes or no]
yes
Preparing...                ########################################### [100%]
   1:WowzaMediaServer       ########################################### [100%]

Install Location:
  /usr/local/WowzaMediaServer

To enter license key:
  cd /usr/local/WowzaMediaServer/bin
  ./startup.sh

[root@localhost src]#

This will install wowza in the location /usr/local/WowzaMediaServer. 

Start Wowza by running ./startup from

# cd /usr/local/WowzaMediaServer/bin

If you are starting Wowza for first time this will prompt for license key, So you can put the license key here. If you don’t have the license key you can get a 30 day license key from wowza.com.

Add the service in chkconfig  to start wowza in start up.

# chkconfig -add WowzaMediaServer
# chkconfig WowzaMediaServer on


Startup scripts are located in /etc/init.d/WowzaMediaServer, You can start/stop the service using the command service WowzaMediaServer start/stop/restart.

Once we started the wowza, RTMP will start to listen in the TCP port 1935.


Thursday, 30 January 2014

Mongodb service wont start

I recently come accros this situation, when  i start the mognod service, i  was getting the below error.

[root@ip-xx-xx-xxx-xx mongo]# /etc/init.d/mongod start
Starting mongod: about to fork child process, waiting until server is ready for connections.
forked process: 19972
all output going to: /var/log/mongo/mongod.log
ERROR: child process failed, exited with error number 45
                                                           [FAILED]
[root@ip-xx-xx-xxx-xx mongo]# /etc/init.d/mongod restart
Stopping mongod:                                           [FAILED]
Starting mongod: about to fork child process, waiting until server is ready for connections.
all output going to: /var/log/mongo/mongod.log
forked process: 20004
ERROR: child process failed, exited with error number 45
                                                           [FAILED]


To fix this issue, I   got some fixes to repair the mongodb instance.  So in screeen i tried the repair command with the mongodb db path(in my case it is /var/lib/mongo/ ),

[root@ip-xx-xx-xxx-xx mongo]# mongod --dbpath /var/lib/mongo/ --repair

Then i run

[root@ip-xx-xx-xxx-xx mongo]# mongod --dbpath /var/lib/mongo/&



This will fix the issue partially,  mongodb   service will start after this.  But this is not the  actual fix to this issue.

This  is an error due to the permission on the db path of mongodb.

In my case when i check,  the location /var/lib/mongo  it was owned by root and group root.  We need to chnage this to mongod

So i ran this command and  fixed the issue.

[root@ip-xx-xx-xxx-xx mongo]# cd /var/lib/
[root@ lib]# chown -R mongod.mongod mongo

Then you can start the mongod  service.

[root@ip-xx-xx-xxx-xx mongo]# /etc/init.d/mongod start
Starting mongod: Thu Jan 30 18:22:11.350
Thu Jan 30 18:22:11.370 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Thu Jan 30 18:22:11.370
about to fork child process, waiting until server is ready for connections.
all output going to: /var/log/mongo/mongod.log
forked process: 10293
child process started successfully, parent exiting
                                                           [  OK  ]
[root@ip-xx-xx-xxx-xx mongo]#

Tuesday, 10 December 2013

How to create and use an AWS S3 bucket with s3cmd tool


Amazon S3 is a reasonably priced data storage service. Ideal for off-site backups, archiving and other data storage needs.  S3cmd is a command line tool for uploading, retrieving and managing data in Amazon S3. S3cmd is an open source project available under GNU Public License v2 (GPLv2) and is free for both commercial and private use. You will only have to pay Amazon for using their storage.

Installation of s3cmd package

 S3tools / S3cmd project homepage:
    http://s3tools.sourceforge.net

Amazon S3 homepage:
    http://aws.amazon.com/s3

Installation of RPM package
---------------------------
As user "root" run:

        rpm -ivh s3cmd-X.Y.Z.noarch.rpm

where X.Y.Z is the most recent s3cmd release version.


Installation of source .tar.gz package
--------------------------------------
There are three options to run s3cmd from source tarball:

1) S3cmd program as distributed in s3cmd-X.Y.Z.tar.gz
   can be run directly from where you untar'ed the package.

2) Or you may want to move "s3cmd" file and "S3" subdirectory
   to some other path. Make sure that "S3" subdirectory ends up
   in the same place where you move the "s3cmd" file.

   For instance if you decide to move s3cmd to you $HOME/bin
   you will have $HOME/bin/s3cmd file and $HOME/bin/S3 directory
   with a number of support files.

3) The cleanest and most recommended approach is to run

        python setup.py install

   You will however need Python "distutils" module for this to
   work. It is often part of the core python package (e.g. in
   OpenSuse Python 2.5 package) or it can be installed using your
   package manager, e.g. in Debian use

        apt-get install python2.4-setuptools



Configure  S3cmd:


To configure s3cmd, you need two information: • Access Key • Secret Key
You can get these credentials from: •
https://aws-portal.amazon.com/gp/aws/securityCredentials
Run “s3cmd –configure” command

[root@ip-XXX-XX-XX-XX ~]# s3cmd --configure

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key: __[Your Access Key]__
Secret Key: __[Your Secret Key]__

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: __[Your passphrase to protect your Secret Key]__
Path to GPG program [/usr/bin/gpg]:

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]: yes

New settings:
  Access Key: [Your Access Key]
  Secret Key: [Your Secret Key]
  Encryption password: [Your passphrase to protect your Secret Key]
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: True
  HTTP Proxy server name:
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n]
Please wait...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Success. Encryption and decryption worked fine :-)

Save settings? [y/N] y
Configuration saved to '/root/.s3cfg'
[root@ip-XXX-XX-XX-XX ~]#


Create the S3 bucket:

[root@ip-XXX-XX-XX-XX ~]#s3cmd mb s3://test123
Bucket 's3://test123/' created
[root@ip-XXX-XX-XX-XX ~]#



Put a public file on this bucket:

[root@ip-XXX-XX-XX-XX ~]#s3cmd --acl-public put video1.mp4 s3://test123
video1.mp4 -> s3://test123/video1.mp4  [1 of 1]
 1685 of 1685   100% in    0s     4.12 kB/s  done
Public URL of the object is: http://test123.s3.amazonaws.com/video1.mp4
[root@ip-XXX-XX-XX-XX ~]#


Or can use the below command

s3cmd --config=/root/.s3cfg put --acl-public videos1.mp4 s3://test123 
 
Listing files:

[root@ip-XXX-XX-XX-XX ~]# s3cmd ls s3://test123
2012-02-09 03:26      1685   s3://test123/video1.mp4
[root@ip-XXX-XX-XX-XX ~]#


Get files through s3cmd:

[root@ip-XXX-XX-XX-XX ~]# s3cmd get s3://test123/video1.mp4



For more details please  go through the url, http://s3tools.org/s3cmd

Thursday, 17 October 2013

Difference between rewrite and redirect

The main difference between rewriting and redirecting is,  Redirecting sends a HTTP 301 or 302 to the client, telling the client that it should try to access the page using another URL. This means that the client knows that there is another URL that should be used. The communication between the server and client is like:

Request 1 (from client):     Get index.php
Response 1 (from server).  The file is moved, please request the file temp_index.php
Request 2 (from client):     Get temp_index.php
Response 2 (from server):  Here is the content of temp_index.php

Rewriting happens on the server, and simply is a translation of one URL to another, that is used by your web application. The client does not know that internally there is another URL, it just sees the one it sent to the server.

Request 1 (from client):       Get  index.php
URL Rewriting (on server):   Translate the URL  index.php  to temp_index.php
Web application (on server): Process the request (run any code in temp_index.php)
Response 1 (from server):    Here is the content of index.php (note that the client does not know that this is the content of temp_index.php)

Monday, 7 October 2013

MediaWiki Installation

MediaWiki is a free, open source wiki software developed by Wikimedia Fountation.

Prerequisites

Install Apache, MySQL, PHP and necesary PHP modules.

create database called mediawikidb and user called mediawikiadmin with password centos.

mysql> create database mediawikidb;
Query OK, 1 row affected (0.03 sec)

mysql> GRANT ALL PRIVILEGES ON mediawikidb.* TO 'mediawikiadmin' IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.05 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

Download the latest version from

[root@station254 src]# wget http://download.wikimedia.org/mediawiki/1.21/mediawiki-1.21.1.tar.gz
[root@station254 src]# tar zxvf mediawiki-1.21.1.tar.gz
[root@station254 src]# mv mediawiki-1.21.1 /var/www/html/mediawiki

Begin Installation

Navigate to http://ip-address or domain/mediawiki/ from your browser and follow the onscreen instructions.


Click On setup the wiki first link. Select your language and click Continue


Now the installer will perform the environment checks. If everything seems Ok, Click Continue.



Enter MySQL Settings such as Database name, user and password etc. 



Select MySQL storage engine and click Continue.


Enter your Wikipedia website name and create a  new administrative account with username, password and mail id.



Click Continue.



Now the Wikipedia website has been installed successfully. The installer will download a file called LocalSettings.php which contains all your configuration details. It is recommended to download and keep it safe, you will need it. 


Copy the downloaded LocalSettings.php file to the mediawiki directory. And set write permissions of the LocalSettings.php and WebStart.php files. 

[root@station254 mediawiki]# chmod 755 LocalSettings.php

[root@station254 mediawiki]# chmod 755 includes/WebStart.php


Now click on enter to wiki link or navigate to http://ip-address or domain/mediawiki/ from your browser. Now you will be redirected to your wikipedia home page. 



Thats it. Start uploading contents and spread the word of your new wiki website.