SWAT Blog

Nginx Server Blocks Setup on Ubuntu 14.04 LTS

May 6th, 2016 by Bhagwan Dass

(Nginx Server Blocks run more than one domain on a single server)

Prerequisites:-
User with sudo privileges.

Open Terminal and install Nginx on your server by typing:-

user1@ubuntu:~$ sudo apt-get update
user1@ubuntu:~$ sudo apt-get install nginx

Create directories for each domain example.com and myexample.com site:-

user1@ubuntu:~$ sudo mkdir -p /var/www/example.com/html
user1@ubuntu:~$ sudo mkdir -p /var/www/myexample.com/html

Transfer ownership to our regular user.

user1@ubuntu:~$ sudo chown -R $USER:$USER /var/www/example.com/html
user1@ubuntu:~$ sudo chown -R $USER:$USER /var/www/myexample.com/html

Correct the permissions of our web roots.

user1@ubuntu:~$ sudo chmod -R 755 /var/www

Create Sample Pages for each site.
We’ll create a first basic file that indicates what site we are currently accessing.

user1@ubuntu:~$ vim /var/www/example.com/html/index.html
<html>
    <head>
        <title>Welcome to Example.com!</title>
    </head>
    <body>
        <h1>Success! Working!</h1>
    </body>
</html>

Save and Exit.
Our second site is the same, we can copy first site over to our second document root.

user1@ubuntu:~$ cp /var/www/example.com/html/index.html /var/www/myexample.com/html/

Now,we open the 2nd file in editor and modify it so that it refers to our second domain.

user1@ubuntu:~$ vim /var/www/myexample.com/html/index.html
<html>
    <head>
        <title>Welcome to Myexample.com!</title>
    </head>
    <body>
        <h1>Success! Working!</h1>
    </body>
</html>

Save and Exit.

Create Server Block Files for each Domain.
We will create our first server block config file by copying over the default file.

user1@ubuntu:~$ sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com

Now, open the file example.com you created in your text editor with root privileges.
Your file will look something like this:

user1@ubuntu:~$ sudo vim /etc/nginx/sites-available/example.com
 
  server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        #root /usr/share/nginx/html;
        root /var/www/example.com/html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        #server_name localhost;
        server_name example.com www.example.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

Save and Exit.

Copy initial server block configuration over to create a new file. Open new file with root privileges in editor.
Your file will look something like this:

user1@ubuntu:~$ sudo cp /etc/nginx/sites-available/example.com /etc/nginx/sites-available/myexample.com

server {
        #listen 80 default_server;
        #listen [::]:80 default_server ipv6only=on;
        listen 80;
        listen [::]:80;
        #root /usr/share/nginx/html;
        root /var/www/myexample.com/html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        #server_name localhost;
        server_name myexample.com www.myexample.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

Save and Exit.

Enable our server blocks and restart Nginx.

user1@ubuntu:~$ sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
user1@ubuntu:~$ sudo ln -s /etc/nginx/sites-available/myexample.com /etc/nginx/sites-enabled/

We can disable the default server block file by simply removing the symbolic link.
It will still be available for reference in the sites-available directory, but it won’t be read by Nginx on startup.

user1@ubuntu:~$ sudo rm /etc/nginx/sites-enabled/default
Find #server_names_hash_bucket_size 64; and remove the comment from default Nginx configuration file.
user1@ubuntu:~$ sudo vim /etc/nginx/nginx.conf
#server_names_hash_bucket_size 64;
user1@ubuntu:~$ sudo service nginx restart
Edit file /etc/hosts and add the virtual domain names one by one as shown below.
user1@ubuntu:~$ sudo vi /etc/hosts
127.0.0.1       localhost
127.0.1.1       user1
172.17.0.48     example.com
172.17.0.48     myexample.com
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Save and Exit.
Open up your browser and point to the URL, you should see the sample pages.

http://example.com
http://myexample.com

If you are on command line (Terminal) then browse URL shown below.

user1@ubuntu:~$ links http://example.com/
user1@ubuntu:~$ links http://myexample.com/

If you want to access these sites from remote systems, you should add the actual domain name records in DNS server. Similarly, you can add as many as Server Blocks you wanted.

Setting up Glassfish Server Behind Apache https

May 7th, 2015 by Bhagwan Dass

Installing Glassfish and Deploying one sample.war application:

After you unzip Glassfish, you can start the server by running this command:


mint-pc~#GLASSFISH_HOME/glassfish/bin/./asadmin start-domain

This command will start the default domain included in the server, which is called domain1.
After a few seconds, you should be able to browse to its default page at http://server-ip:8080 or the Web Admin Panel at http://server-ip:4848.

After this, we’ll use the asadmin commnad to to add an http listener called jk-connector-8009, which will listen on port 8009 for AJP connections.
This is the port that Apache will use to redirect requests from port 80 to Glassfish, and back to Apache.

Create the listener:

mint-pc~#GLASSFISH_HOME/glassfish/bin/./asadmin --user admin --host localhost --port 4848 create-http-listener --listeneraddress 0.0.0.0 --listenerport 8009 --defaultvs server jk-connector-8009

Activate the listener:

mint-pc~#GLASSFISH_HOME/glassfish/bin/./asadmin --user admin --host localhost --port 4848 setconfigs.config.server-config.network-config.network-listeners.network-listener.jk-connector-8009.jk-enabled=true

Finally, restart the Glassfish Server:

mint-pc~#GLASSFISH_HOME/glassfish/bin/./asadmin stop-domain

mint-pc~#GLASSFISH_HOME/glassfish/bin/./asadmin start-domain

Configuring Apache:
Installing and configure Apache2 and mod_jk:–

mint-pc~#apt-get install libapache2-mod-jk

Installing mod_jk this way will ensure that the mod_jk module is enabled for Apache2. You can check and verify that with:-

mint-pc~#ls -l /etc/apache2/mods-enabled/jk.load (Should show like below line)

lrwxrwxrwx 1 root root 25 2009-08-12 14:18 /etc/apache2/mods-enabled/jk.load -&gt; ../mods-available/jk.load

In case the module is missing from the monds-enabled directory, enable it with:

mint-pc~#a2enmod jk

Run this command on terminal:-

mint-pc~#grep -r JkWorkersFile /etc/apache2 (Default workers.properties file path)

/etc/apache2/mods-available/jk.conf: JkWorkersFile /etc/libapache2-mod-jk/workers.properties

Put Below mentioned text in workers.properties file.
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300

A file called /etc/apache2/mods-available/jk.conf (Should have below text)
# Where to find workers.properties
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
# Where to put jk logs
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info

The only thing to do is to specify which URL paths should be redirected to mod_jk.
I added these lines to /etc/apache2/sites-enabled/000-default.conf within the <VirtualHost></VirtualHost> tags:

# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /* worker1

Finally restart apache2:-

mint-pc~#/etc/init.d/apache2 restart

Tested in Firefox and Chrome working:-
http://localhost/sample/
http://localhost:8080/sample/

Create a SSL Certificate on Apache for Ubuntu 14.04

mint-pc~#apt-get update

mint-pc~#apt-get install apache2

Activate the SSL Module:-

mint-pc~#a2enmod ssl

mint-pc~#service apache2 restart

Create a Self-Signed SSL Certificate:-

mint-pc~#mkdir /etc/apache2/ssl

Now that we have a location to place our key and certificate, we can create them both in one step by typing:

mint-pc~#openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Hit “ENTER”, you will be asked a number of questions:-
The questions portion looks something like this:
Country Name (2 letter code) [AU]:IN
State or Province Name (full name) [Some-State]:U.P.
Locality Name (eg, city) []:Noida
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SW-AT
Organizational Unit Name (eg, section) []:IT
Common Name (e.g. server FQDN or YOUR name) []:www.curowin.com
Email Address []:admin@sw-at.com

The key and certificate will be created and placed in your /etc/apache2/ssl directory:-

Configure Apache to Use SSL:-

mint-pc~#gedit /etc/apache2/sites-available/000-default.conf

<VirtualHost *:443>
#ServerName www.example.com

ServerAdmin webmaster@localhost
ServerName 127.0.0.1:443 #(or your domain name:443)
DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

#Send everything for context /examples to worker named worker1 (ajp13)
JkMount /* worker1

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

</VirtualHost>
#vim: syntax=apache ts=4 sw=4 sts=4 sr noet


mint-pc~#service apache2 restart

https://localhost/sample/

Generate Date Ranges in Oracle PL/SQL

January 28th, 2014 by Atul Sharma

Here is an easy way to generate date ranges in oracle pl/sql:

WITH t AS
  (SELECT to_date('01-OCT-2012') start_date,
    to_date('30-SEP-2013') end_date
  FROM dual
  )
  SELECT add_months(TRUNC(start_date,'mm'),LEVEL      - 1) START_DATE,
    add_months(add_months(TRUNC(start_date,'mm'),LEVEL - 1),1)-1 END_DATE
  FROM t
    CONNECT BY TRUNC(end_date,'mm') >= add_months(TRUNC(start_date,'mm'),LEVEL - 1)

OUTPUT:

START_DATE  END_DATE  
----------- -----------
01-OCT-2012 31-OCT-2012 
01-NOV-2012 30-NOV-2012 
01-DEC-2012 31-DEC-2012 
01-JAN-2013 31-JAN-2013 
01-FEB-2013 28-FEB-2013 
01-MAR-2013 31-MAR-2013 
01-APR-2013 30-APR-2013 
01-MAY-2013 31-MAY-2013 
01-JUN-2013 30-JUN-2013 
01-JUL-2013 31-JUL-2013 
01-AUG-2013 31-AUG-2013 
01-SEP-2013 30-SEP-2013 

 12 rows selected

Extend and Remove the Logical Volume (LVM)

February 12th, 2013 by Bhagwan Dass

Advantage of LVM is that we can Extend Reduce or Remove volumes any time.

Extend logical volume:-

Here we extend 500MB in Logical Volume lv0

[root@localhost ~]#lvextend -L +500 /dev/vg0/lv0

Extending logical volume lv0 to 1.49 GiB
Logical volume lv0 successfully resized

[root@localhost ~]#resize2fs /dev/vg0/lv0

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg0/lv0 is mounted on /lvm-disk; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg0/lv0 to 390144 (4k) blocks.
The filesystem on /dev/vg0/lv0 is now 390144 blocks long.

Remove logical volume:-
Make sure the volume is unmounted and no data in logical volume:-

[root@localhost lvm-disk]# lvdisplay

— Logical volume —
LV Path /dev/vg0/lv0
LV Name lv0
VG Name vg0
LV UUID 5oGJ4c-In6O-gJsl-2bT1-QLNV-f5sw-wHwswe
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-11 14:14:00 +0530
LV Status available
# open 0
LV Size 500.00 MiB
Current LE 125
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

— Logical volume —
LV Path /dev/vg0/lv1
LV Name lv1
VG Name vg0
LV UUID 835410-RrAU-EMCK-qSL2-GsPC-3AR7-goalKl
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-12 09:44:42 +0530
LV Status available
# open 0
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1

[root@localhost lvm-disk]# lvremove /dev/vg0/lv0

Do you really want to remove active logical volume lv0? [y/n]: y
Logical volume “lv0″ successfully removed

[root@localhost lvm-disk]# lvdisplay

— Logical volume —
LV Path /dev/vg0/lv1
LV Name lv1
VG Name vg0
LV UUID 835410-RrAU-EMCK-qSL2-GsPC-3AR7-goalKl
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-12 09:44:42 +0530
LV Status available
# open 1
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1

Done…

Logical Volume Management Linux (LVM)

February 11th, 2013 by Bhagwan Dass

To View All Existing Disk Partitions:-

[root@localhost ~]#fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006e148

Device Boot Start End Blocks Id System
/dev/sda1 * 1 77 614400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 77 6451 51200000 83 Linux
/dev/sda3 6451 6834 3072000 82 Linux swap / Solaris

Note:- In this disk I have 20 GB disk space left as unallocated
Now Create a New Disk Partition with Specific Size:-

[root@localhost ~]#fdisk /dev/sda

Command (m for help): n
First cylinder (6834-8139, default 6834):
Using default value 6834
Last cylinder, +cylinders or +size{K,M,G} (6834-8139, default 8139): +10G

Note:-If you want to use up all available space after the initial sector, just press Enter.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

Repeate above Steps for second partition.
Two partition of 10GB, 10GB is created, format it using the mkfs command

[root@localhost ~]#partprobe /dev/sda (Run Partprobe or Reboot the system)

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.

Formate the partitions /dev/sda5 and /dev/sda6 one by one:-

[root@localhost ~]#mkfs.ext4 /dev/sda5

mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
305824 inodes, 1222602 blocks
61130 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1254096896
38 block groups
32768 blocks per group, 32768 fragments per group
8048 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Create Physical Volume by pvcreate command:-

[root@localhost ~]#pvcreate /dev/sda5 /dev/sda6

Writing physical volume data to disk “/dev/sda5″
Physical volume “/dev/sda5″ successfully created
Writing physical volume data to disk “/dev/sda6″
Physical volume “/dev/sda6″ successfully created

Create Volume Group by vgcreate command:-


[root@localhost ~]#vgcreate vg0 /dev/sda5 /dev/sda6

Volume group “vg0″ successfully created

[root@localhost ~]#vgdisplay

(Display Volume Group)
— Volume group —
VG Name vg0
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 18.64 GiB
PE Size 4.00 MiB
Total PE 4772
Alloc PE / Size 0 / 0
Free PE / Size 4772 / 18.64 GiB
VG UUID uKm3bZ-2uHb-0DJe-hur5-vbm3-pI8O-L2kL10

Create Logical Volume by lvcreate command:-

[root@localhost ~]#lvcreate -L 1024MB -n /dev/vg0/lv0

Logical volume “lv0″ created

[root@localhost ~]#lvdisplay    (Display Logical Volume)

— Logical volume —
LV Path /dev/vg0/lv0
LV Name lv0
VG Name vg0
LV UUID 5oGJ4c-In6O-gJsl-2bT1-QLNV-f5sw-wHwswe
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-11 14:14:00 +0530
LV Status available
# open 0
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

Formate the Logical Volume by mkfs command:-

[root@localhost ~]#mkfs.ext4 /dev/vg0/lv0

mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Create a Directory and mount the LVM Partiotion:-

[root@localhost ~]#mkdir /lvm-disk
[root@localhost ~]#mount /dev/vg0/lv0 /lvm-disk

Enter fstab entry for permanent mount:-

[root@localhost ~]#vi /etc/fstab

/dev/vg0/lv0 /lvm-disk ext4 defaults 0 0

[root@localhost ~]#df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 49G 2.7G 45G 6% /
tmpfs 939M 88K 939M 1% /dev/shm
/dev/sda1 591M 90M 472M 16% /boot
/dev/mapper/vg0-lv0 1008M 34M 924M 4% /lvm-disk

NFS Server Setup on Ubuntu server and Desktop

December 28th, 2012 by Bhagwan Dass

Server side Configuration–

root@server-desktop:~#apt-get install nfs-kernel-server portmap nfs-common nfswatch

 

root@server-desktop:~#mkdir /srv/nfs

 

root@server-desktop:~#chown nobody:nogroup /srv/nfs/

 

root@server-desktop:~#vi /etc/exports

#ADD BELOW LINES IN exports FILE save and exit.(Ip address of the server system)

/srv/nfs 172.17.0.20/255.255.0.0(rw,sync,no_subtree_check)

#Then Run this command on Terminal–


root@server-desktop:~#exportfs -a

#Then restart nfs and portmap services


root@server-desktop:~#/etc/init.d/nfs-kernel-server restart

* Stopping NFS kernel daemon [ OK ]

* Unexporting directories for NFS kernel daemon… [ OK ]

* Exporting directories for NFS kernel daemon… [ OK ]

* Starting NFS kernel daemon [ OK ]


root@server-desktop:~#/etc/init.d/portmap restart

Rather than invoking init scripts through /etc/init.d, use the service(8)

utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an

Upstart job, you may also use the stop(8) and then start(8) utilities,

e.g. stop portmap ; start portmap. The restart(8) utility is also available.

portmap stop/waiting

portmap start/running, process 3784

#To check nfs folder run showmount command–


root@server-desktop:~#showmount -e

#Above command show nfs folder–

Export list for server-desktop:

/srv/nfs 172.17.0.20/255.255.0.0

Ubuntu Client side Configuration–


root@desktop:~#apt-get install nfs-common portmap

#Now make a folder in /mnt.


root@desktop:~#mkdir /mnt/nfs

 


root@desktop:~#mount 172.17.0.20:/srv/nfs /mnt/nfs

#Below command will show all mounted folders.


root@desktop:~#df -h

Fedora 17 Client side Configuration–


[root@administrator ~]#yum -y install nfs-utils

Loaded plugins: fastestmirror, langpacks, presto, refresh-packagekit

Loading mirror speeds from cached hostfile

* fedora: mirror.cse.iitk.ac.in

* rpmfusion-free: mirror.cse.iitk.ac.in

* rpmfusion-free-updates: mirror.cse.iitk.ac.in

* rpmfusion-nonfree: mirror.cse.iitk.ac.in

* rpmfusion-nonfree-updates: mirror.cse.iitk.ac.in

* updates: mirrors.ustc.edu.cn

Resolving Dependencies

–> Running transaction check

—> Package nfs-utils.i686 1:1.2.6-6.fc17 will be installed

–> Processing Dependency: quota for package: 1:nfs-utils-1.2.6-6.fc17.i686

–> Processing Dependency: libnfsidmap.so.0 for package: 1:nfs-utils-1.2.6-6.fc17.i686

–> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.2.6-6.fc17.i686

–> Running transaction check

—> Package libnfsidmap.i686 0:0.25-3.fc17 will be installed

—> Package quota.i686 1:4.00-5.fc17 will be installed

–> Processing Dependency: quota-nls = 1:4.00-5.fc17 for package: 1:quota-4.00-5.fc17.i686

–> Running transaction check

—> Package quota-nls.noarch 1:4.00-5.fc17 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

=========================================================================

Package Arch Version Repository Size

=========================================================================

Installing:

nfs-utils i686 1:1.2.6-6.fc17 updates 319 k

Installing for dependencies:

libnfsidmap i686 0.25-3.fc17 updates 33 k

quota i686 1:4.00-5.fc17 updates 162 k

quota-nls noarch 1:4.00-5.fc17 updates 74 k

Transaction Summary

=========================================================================

Install 1 Package (+3 Dependent packages)

Total download size: 588 k

Installed size: 2.0 M

Downloading Packages:

(1/4): libnfsidmap-0.25-3.fc17.i686.rpm | 33 kB 00:01

(2/4): nfs-utils-1.2.6-6.fc17.i686.rpm | 319 kB 00:01

(3/4): quota-4.00-5.fc17.i686.rpm | 162 kB 00:02

(4/4): quota-nls-4.00-5.fc17.noarch.rpm | 74 kB 00:01

——————————————————————————–

Total 83 kB/s | 588 kB 00:07

Running Transaction Check

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : 1:quota-nls-4.00-5.fc17.noarch 1/4

Installing : 1:quota-4.00-5.fc17.i686 2/4

Installing : libnfsidmap-0.25-3.fc17.i686 3/4

Installing : 1:nfs-utils-1.2.6-6.fc17.i686 4/4

Verifying : libnfsidmap-0.25-3.fc17.i686 1/4

Verifying : 1:nfs-utils-1.2.6-6.fc17.i686 2/4

Verifying : 1:quota-4.00-5.fc17.i686 3/4

Verifying : 1:quota-nls-4.00-5.fc17.noarch 4/4

Installed:

nfs-utils.i686 1:1.2.6-6.fc17

Dependency Installed:

libnfsidmap.i686 0:0.25-3.fc17

quota.i686 1:4.00-5.fc17

quota-nls.noarch 1:4.00-5.fc17

Complete!


[root@administrator ~]#mount 172.17.0.20:/srv/nfs /mnt/nfs

Enabling the NFS client on Windows 7 Ultimate/Enterprises system:

  1. Select Control Panel.
  2. Select Programs.
  3. Select Programs and Features.
  4. Select Turn Windows Features on or off.
  5. Select Services for NFS.
  6. Select the check box Client for NFS and click OK.

Run Below Command On Command Prompt:-

mount -o //172.17.0.20:/srv/nfs z:

Fixed: Google Chrome Can Not Be Run As Root. (Ubuntu)

December 13th, 2012 by Vikash Trivedi

Google restricted running Chrome from root user account as it is directly linked with security issues. So if you understand the risks, here is how to make Google Chrome work from root.

  1. Open a Terminal Window (Ctl+Alt+T)
  2. Run this command -> sed -i ‘s/geteuid/getppid/g’ /opt/google/chrome/chrome
  3. Launch Google Chrome

This is assuming the google executable is present at /opt/google/chrome/chrome. Otherwise replace it with the correct path.

Virtual Scrolling with dGrid – dojo, dGrid, node.js and mongodb

May 9th, 2012 by Atul Sharma

Recently Sitepen has released a beta of light-weight feature-rich data grid component (compatible with dojo 1.7) called dgrid. I am working on upgrading an application that uses dojo 1.4 to dojo 1.7 and was looking for replacing the custom grid solution that I wrote with a better grid systems. My requirements were to replace the pagination with virtual scrolling and server side sorting – dgrid fits the bill. Though I couldn’t find any example of such an implementation and as such I thought of writing an example my self and share with others in this blog post.

The example shows the SnP 500 company list (data taken from wikipedia) in dgrid setup for virtual scrolling and server side sorting.

Technologies I have used are as follows:

  1. Frontend – Dojo 1.7/HTML/JavaScript (dgrid, put-selector and xstlye AMD based modular components)
  2. Services – node.js (Express – for exposing/routing REST based services and Mongoskin – as mongodb driver)
  3. Database – mongodb

The main objective of this post is to highlight how dgrid can be used for virtual scrolling. I have used node.js and mongodb as I find these appropriate for quick prototyping and as such I will not cover details of these technologies in this post. Once the mechanism of REST calls is clear any technology stack can be used to provide REST services.

Project Setup

  1. Create project directory (PROJECT_ROOT)- In this example project directory is ‘dgrid_virtual_scroll’
  2. Create subdirectory ‘PROJECT_ROOT/public/resources/js/lib’ under project directory
  3. Download and extract following under ‘PROJECT_ROOT/public/resources/js/lib':
    1. dojo toolkit 1.7 – http://dojotoolkit.org/download/
    2. dgrid – http://dojofoundation.org/packages/dgrid/#demos
    3. xstlye – https://github.com/kriszyp/xstyle
    4. put-selector – https://github.com/kriszyp/put-selector
  4. Make sure node.js and npm are installed – Installation can be found at http://nodejs.org/#download
  5. Install express and mongoskin packages using npm
    1. navigate to project directory (PROJECT_ROOT)
    2. Run following commands:
      npm install express
      npm install mongoskin
      
  6. Create blank index.html file under PROJECT_ROOT/public directory
  7. Create blank app.js file under PROJECT_ROOT directory

The directory structure should look like the figure below:

Database setup

  1. Install mongodb – http://www.mongodb.org/downloads
  2. Insert data:
    1. download test data file – companies.txt
    2. Start mongodb server by running command:
      mongod
      
    3. import test data file by running following command:
      mongoimport -d snp -c companies companies.txt
      

      The command will import the data in a collection called companies in a database called snp in mongodb.

Create Node.js service application
Open file PROJECT_ROOT/app.js and copy following code:

var http = require('http'),
	express = require('express'),
    mongo = require('mongoskin'),
    server = new mongo.Server('localhost', 27017, {auto_reconnect: true}),
    db = new mongo.Db('snp', server);


 var app = module.exports = express.createServer();
app.configure(function() {
  app.set('views', __dirname + '/views');
  app.use(express.favicon());
  app.use(express.bodyParser());
  app.use(express.cookieParser());
  app.use(express.logger({ format: 'x1b[1m:methodx1b[0m x1b[33m:urlx1b[0m :response-time ms' }))
  app.use(express.methodOverride());
  app.use(express.static(__dirname + '/public'));
});
 

app.get('/rest',  function(req, res) {
	var urlpart = req.url;
	var sortObj ={};
	if(urlpart){
		if(urlpart.indexOf('(')>-1){
			var sortpart=urlpart.split('(')[1].slice(0, -1);
			var sortfield=sortpart.substring(1);
			var sortsign=sortpart.substring(0,1);
			var sortdirection=1;
			if (sortsign==='-') sortdirection=-1;
			sortObj = JSON.parse('{"'+sortfield+'":'+sortdirection+'}');
		}
	}
	console.log(sortObj)
	var start=0;
	var end=10000;	
	var range=req.header('Range');
	if(range!==null && range !==undefined){
		var m=range.split('=')[1].split('-');
	 	start=parseInt(m[0]);
		end=parseInt(m[1]);
	}
	var pagesize=end-start+1;
	db.open(function(dberr, db) {
		if(!dberr){
			db.collection('companies').count(function(err, data){
				res.header('Content-Range',start+'-'+end+'/'+data);
				db.collection('companies').find().sort(sortObj).skip(start).limit(pagesize).toArray(function(err, items){
					res.send(JSON.stringify(items));
					db.close();
				}) ;

			}) ;
		}	
	});
	
	
});
app.get('/',  function(req, res) {
		res.redirect('/index.html');
});
  
if (!module.parent) {
  app.listen(3000);
  console.log('Express server listening on port %d, environment: %s', app.address().port, app.settings.env)
}

Line 55 in above code is the default routing to the index.html page (we’ll come to it shortly) and Line 18 is routing of REST service call from index.html which sends the JSON back to the index.html. The documentation for REST API for JsonRest can be found at http://dojotoolkit.org/reference-guide/1.7/quickstart/rest.html. Thanks are due to Ken Franqueiro for pointing me to the API doc – which I found very useful.

Create index.html Application frontend
Open file PROJECT_ROOT/public/index.html and copy the following code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Test JsonRest store</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<style type="text/css">
			@import "/resources/js/lib/dojo/resources/dojo.css";
			@import "/resources/js/lib/dgrid/css/skins/claro.css";
			@import "/resources/js/lib/dijit/themes/claro/claro.css";		
			#container { width: 960px; margin: auto; }
			#grid{ height:500px; }
		</style>
		<script type="text/javascript" src="/resources/js/lib/dojo/dojo.js" data-dojo-config="async: true"></script>
	</head>
	<body class="claro">
		<div id="container"></div>
	</body>
	<script type="text/javascript">
		require(["dojo/dom", "dgrid/OnDemandGrid", "dgrid/Selection","put-selector/put", 
			"dgrid/Keyboard", "dojo/_base/declare", "dojo/store/JsonRest", 
			"dojo/store/Observable", "dojo/domReady!" ], 
			function(dom, Grid, Selection, put, Keyboard, declare, JsonRest, Observable) {
				function initView(){
					put(dom.byId("container"),"div#grid");
					
					var companyStore = Observable(JsonRest({
						target : "/rest",
						idProperty : "_id"
					}));
					
					var columns = [ {
						label : 'S&P Ticker',
						field : 'ticker',
						sortable : true
					}, {
						label : 'Company Name',
						field : 'company',
						sortable : true
					}, {
						label : 'Industry',
						field : 'industry',
						sortable : true
					}, {
						label : 'Head Office',
						field : 'headoffice',
						sortable : true
					}];
			
					var grid = new (declare([ Grid, Selection, Keyboard ]))({
						store : companyStore,
						getBeforePut : false,
						columns : columns,
						minRowsPerPage : 25,
						loadingMessage: 'Loading data...',
						noDataMessage: 'No data found'
					}, "grid");
			}   		
			initView();
		});
	</script>
</html>

Run application

  1. Make sure mongodb is up and running
  2. Startup node application by running following command:
    cd PROJECT_ROOT
    node app.js
    npm install mongoskin
    
  3. Open http://localhost:3000/ you should see the view similar to following:
  4. Try scrolling down and sorting by clicking on column headers and notice the Mongodb and Node.js console windows how the calls are being made and the results on the browser window

If you have firebug installed you can open firebug and can see various header variables and request parameters that are used during rest calls:

In nutshell The Virtual scrolling and pagination request and response parameter looks like following:

  1. REST request – Range of data is sent in Request Header under Range variable with value like ‘items=24-68′ and sort field name and direction is sent as the part of URL like http://localhost:3000/rest?sort(+ticker) under the braces +/- sign signifies the sort direction and the text is the column name that needs to be sorted
  2. REST response – The data range for the requested range is sent under header variable ‘Content-Range’ the value follows he patter ‘fromIndex-toIndex/totalNumberOfrecords’ in the screenshot you can see 24-68/500 where 24 is start index, 68 is end index and 500 is the total number of records.
  3. I have tried this with over million records it works like a charm.
    DONE!!!

Dia Diagram Editor

February 1st, 2012 by Bhagwan Dass

The Dia Diagram Editor is very good Microsoft Visio alternative, it can be used to draw different types of diagrams, includes support for UML static structure diagrams (class diagrams), entity relationship modeling, and network diagrams.  It has special objects which let you draw many types of diagrams.

Install Dia Editor in Ubuntu, open the terminal and run the following command.

[root@ubuntu ~]#sudo apt-get install dia

Install Dia Editor in Fedora, open the terminal and run the following command.

[root@fedora16 ~]#yum install dia

Installing Alfresco 4.0.C on Ubuntu Server 11.10 (32bit)

January 23rd, 2012 by Bhagwan Dass

Alfresco is the open source Enterprise Content Management (ECM), alternate to Microsoft Sharepoint, providing Document Management, Collaboration, Records Management, Knowledge Management, Web Content Management, and Imaging.

You need to login as root or run the commands below as sudo.

Ensure that you have latest version of linux packages.

root@ubuntu:~#apt-get update
root@ubuntu:~#apt-get upgrade

Create an installation directory for Alfresco:

root@ubuntu:~#mkdir /opt/alfresco40c

Alfresco runs in a Java Servlet container/J2EE server. In this guide we will use Tomcat, which is one of the most popular Servlet container. Servlet container requires a Java VM. We begin with installing Java.

Installing Java
Download JDK in /opt directory and run the installation:

root@ubuntu:~#cd /opt/
root@ubuntu:/opt#wget http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-linux-i586.bin
root@ubuntu:/opt#chmod a+x jdk-6u30-linux-i586.bin
root@ubuntu:/opt#./jdk-6u30-linux-i586.bin

Installation crates a new directory called jdk1.6.0_30.
Rename jdk1.6.0_30 folder to java.

root@ubuntu:/opt#mv jdk1.6.0_30/ java

Now set JAVA_HOME environment variable in /etc/profile to do so:

root@ubuntu:~#vi /etc/profile

Insert below code in the end of the profile file and Restart the server:

export JAVA_HOME=/opt/java/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH

Verify the Java installation, responds with something like below result:

root@ubuntu:~#java -version

java version “1.6.0_30″
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)

MySQL Installation

root@ubuntu:~#apt-get install mysql-server mysql-client

Remember the root password you set when you install the mysql-server.You will need it later on.

Verify the MySQL installation:

root@ubuntu:~#mysql -u root -p

Something like following must be diplayed on the terminal:

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 45
Server version: 5.1.58-1ubuntu1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>show databases;

MySQL responds with:
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.05 sec)
mysql>exit

ImageMagick, SWFTools, FFMpeg and LiberOffice
ImageMagick is used to convert and scale images. FFMpeg is needed if you store video in your repository and want to use the audio video player plugin for Alfresco Share.

root@ubuntu:~#apt-get install imagemagick ffmpeg liberoffice

Verify the installation.

root@ubuntu:~#whereis convert

convert: /usr/bin/convert /usr/share/man/man1/convert.1.gz

root@ubuntu:~#whereis ffmpeg

ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

root@ubuntu:~#whereis soffice.bin

soffice: /usr/bin/soffice

SWFTools is used to create flash from pdf documents, to allow previews of documents in Share. This tool does not exist in the 32bit repositories of Ubuntu 11.10. Download older 32bit version of this tool and dependency libart-2.0-2 2.3.20-2 from https://launchpad.net/ubuntu/lucid/i386/swftools/0.9.0-0ubuntu1.

root@ubuntu:~#wget http://launchpadlibrarian.net/14367554/libart-2.0-2_2.3.20-2_i386.deb
root@ubuntu:~#wget http://launchpadlibrarian.net/27270379/swftools_0.9.0-0ubuntu1_i386.deb

Give execute permission and install both .deb packages.

root@ubuntu:~#chmod a+x libart-2.0-2_2.3.20-2_i386.deb
root@ubuntu:~#chmod a+x swftools_0.9.0-0ubuntu1_i386.deb
root@ubuntu:~#dpkg -i libart-2.0-2_2.3.20-2_i386.deb
root@ubuntu:~#dpkg -i swftools_0.9.0-0ubuntu1_i386.deb

Verify the correct installation.

root@ubuntu:~#whereis pdf2swf

pdf2swf: /usr/bin/pdf2swf /usr/share/man/man1/pdf2swf.1.gz

Tomcat Installation.

Download the Tomcat 6 from http://tomcat.apache.org/download-60.cgi and unpack Tomcat.

root@ubuntu:~#cd /opt/
root@ubuntu:/opt#wget http://mirror.nyi.net/apache/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz

Give Execute Permission and Extract.

root@ubuntu:/opt#chmod a+x apache-tomcat-6.0.35.tar.gz
root@ubuntu:/opt#tar -xvf apache-tomcat-6.0.35.tar.gz

Rename apache-tomcat-6.0.35 to tomcat, and move it to where it should.

root@ubuntu:/opt#mv apache-tomcat-6.0.35 /opt/alfresco40c/tomcat

Verify, Tomcat is installed correctly, let’s start Tomcat.

root@ubuntu:/opt#cd /opt/alfresco40c/tomcat/bin
root@ubuntu:/opt/alfresco40c/tomcat/bin#./startup.sh

Using CATALINA_BASE: /opt/alfresco40c/tomcat
Using CATALINA_HOME: /opt/alfresco40c/tomcat
Using CATALINA_TMPDIR: /opt/alfresco40c/tomcat/temp
Using JRE_HOME: /opt/java/
Using CLASSPATH: /opt/alfresco40c/tomcat/bin/bootstrap.jar

And check a process that running contains ‘java’ in its signature.

root@ubuntu1:/opt/alfresco40c/tomcat/bin#ps -ef |grep java

root 7156 1 2 12:12 pts/0 00:00:02 /opt/java//bin/java
-Djava.util.logging.config.file=/opt/alfresco40c/tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/opt/alfresco40c/tomcat/endorsed -classpath
/opt/alfresco40c/tomcat/bin/bootstrap.jar
-Dcatalina.base=/opt/alfresco40c/tomcat
-Dcatalina.home=/opt/alfresco40c/tomcat
-Djava.io.tmpdir=/opt/alfresco40c/tomcat/temp
org.apache.catalina.startup.Bootstrap start

root 7174 908 0 12:14 pts/0 00:00:00 grep –color=auto java

Done, that works. Now,  shutdown Tomcat.

root@ubuntu:/opt/alfresco40c/tomcat/bin#./shutdown.sh

Using CATALINA_BASE: /opt/alfresco40c/tomcat
Using CATALINA_HOME: /opt/alfresco40c/tomcat
Using CATALINA_TMPDIR: /opt/alfresco40c/tomcat/temp
Using JRE_HOME: /opt/java/
Using CLASSPATH: /opt/alfresco40c/tomcat/bin/bootstrap.jar

Verify.

root@ubuntu:~#ps -ef | grep java

root 7201 908 0 12:21 pts/0 00:00:00 grep –color=auto java

There is no process running that contains ‘java’ Good.

Add additional folders for use with Alfresco.

root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/shared
root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/shared/classes
root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/shared/lib
root@ubuntu:~#mkdir /opt/alfresco40c/tomcat/endorsed

Edit Tomcat’s catalina.properties to tell Tomcat to actually use the added directories under ‘tomcat/shared’.

root@ubuntu:~#vi /opt/alfresco40c/tomcat/conf/catalina.properties

Change the value of the shared.loader=property to the following:

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

Save and Exit.
By default,Tomcat uses ISO-8859-1 character encoding when decoding URLs that are received from a browser. This may cause problems when creating, uploading, and renaming files with international characters. Edit the server.xml file.

root@ubuntu:~#vi /opt/alfresco40c/tomcat/conf/server.xml

Locate the Connector section, and then add the URIEncoding=”UTF-8″ property.

<Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8"
connectionTimeout="20000" redirectPort="8443" >

Save and Exit.
Download the JDBC driver belonging to MySQL instance. http://www.mysql.com/downloads/connector/j/

Give Execute Permission and Extract the archive.

root@ubuntu:~#chmod a+x mysql-connector-java-5.1.18.tar.gz
root@ubuntu:~#tar -xvf mysql-connector-java-5.1.18.tar.gz

Copy the driver to Tomcat.

root@ubuntu:~#cp mysql-connector-java-5.1.18/mysql-connector-java-5.1.18-bin.jar /opt/alfresco40c/tomcat/lib

Download Alfresco Community Edition.
Download the Alfresco-community-4.0.c.zip from:https://process.alfresco.com/ccdl/?file=release/community/build-3979/alfresco-community-4.0.c.zip

root@ubuntu:~#wget http://dl.alfresco.com/release/community/build-3979/alfresco-community-4.0.c.zip

Give Execute Permission and Unzip the archive.

root@ubuntu:~#chmod a+x alfresco-community-4.0.c.zip
root@ubuntu:~#apt-get install unzip
root@ubuntu:~#unzip alfresco-community-4.0.c.zip

This will give you 3 folders; licenses, bin and web-server. Distribute as follows.

root@ubuntu:~#mv bin /opt/alfresco40c/
root@ubuntu:~#mv licenses /opt/alfresco40c/
root@ubuntu:~#mv web-server/endorsed/* /opt/alfresco40c/tomcat/endorsed
root@ubuntu:~#mv web-server/shared/* /opt/alfresco40c/tomcat/shared
root@ubuntu:~#mv web-server/lib/* /opt/alfresco40c/tomcat/lib
root@ubuntu:~#mv web-server/webapps/* /opt/alfresco40c/tomcat/webapps/

Create a folder to store database scripts.

root@ubuntu:~#mkdir /opt/alfresco40c/extras

Create the sql-script to create a database.

root@ubuntu:~#vi /opt/alfresco40c/extras/db_setup.sql

This file has the contents.

create database alfresco default character set utf8 collate utf8_bin;
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;

Create the sql-script to drop the database.

root@ubuntu:~#vi /opt/alfresco40c/extras/db_remove.sql

This file has the contents:

drop database alfresco;
revoke all privileges, grant option from 'alfresco'@'localhost';
drop user 'alfresco'@'localhost';
root@ubuntu:~#mysql -u root -p < /opt/alfresco40c/extras/db_setup.sql

You need your root password after executing above script.

Now Create a file to start Alfresco.

root@ubuntu:~#vi /opt/alfresco40c/alfresco.sh

Fill below code in alfresco.sh.

#!/bin/sh
# Start or stop Alfresco server
# Set the following to where Tomcat is installed
ALF_HOME=/opt/alfresco40c
cd "$ALF_HOME"
APPSERVER="${ALF_HOME}/tomcat"
export CATALINA_HOME="$APPSERVER"
# Set any default JVM values
#export JAVA_OPTS='-Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m -XX:NewSize=256m -server'
export JAVA_OPTS='-Xms512m -Xmx768m -Xss768k -XX:MaxPermSize=256m -XX:NewSize=256m -server'
export JAVA_OPTS="${JAVA_OPTS} -Dalfresco.home=${ALF_HOME} -Dcom.sun.management.jmxremote"
#
if [ "$1" = "start" ]; then
"${APPSERVER}/bin/startup.sh"
# if [ -r ./virtual_start.sh ]; then
# sh ./virtual_start.sh
# fi
# if [ -r ./start_oo.sh ]; then
# sh ./start_oo.sh
# fi
elif [ "$1" = "stop" ]; then
"${APPSERVER}/bin/shutdown.sh"
# if [ -r ./virtual_start.sh ]; then
# sh ./virtual_stop.sh
# fi
# if [ -r ./start_oo.sh ]; then
# killall soffice.bin
# fi
fi

Give execute permission to the script.

root@ubuntu:~#chmod ug+x /opt/alfresco40c/alfresco.sh

Now we need valid alfresco-global.properties, we should be able to start and stop Alfresco.

root@ubuntu:~#cd /opt/alfresco40c
root@ubuntu1:/opt/alfresco40c#./alfresco.sh start

OR

root@ubuntu1:/opt/alfresco40c#./alfresco.sh stop

Check if your action was successful by validating if the process is running (or has stopped. Remind, stopping Alfresco might take a while).

root@ubuntu:~#ps -ef |grep java

root 7710 1 99 15:24 pts/0 00:02:37 /opt/java//bin/java
-Djava.util.logging.config.file=/opt/alfresco40c/tomcat/conf/logging.properties
-Xms512m -Xmx768m -Xss768k -XX:MaxPermSize=256m -XX:NewSize=256m -server
-Dalfresco.home=/opt/alfresco40c -Dcom.sun.management.jmxremote
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/opt/alfresco40c/tomcat/endorsed -classpath
/opt/alfresco40c/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/alfresco40c/tomcat
-Dcatalina.home=/opt/alfresco40c/tomcat
-Djava.io.tmpdir=/opt/alfresco40c/tomcat/temp
org.apache.catalina.startup.Bootstrap start

root 7736 908 0 15:26 pts/0 00:00:00 grep –color=auto java

Alfresco-global.properties

alfresco-global.properties may look like store in tomcat/shared/classes/alfresco-global.properties.

root@ubuntu:~#vi /opt/alfresco40c/tomcat/shared/classes/alfresco-global.properties

This file has the contents.

###############################
 Common Alfresco Properties
###############################
 #
 # Sample custom content and index data location
 #
 dir.root=/opt/alfresco40c/alf_data
 #
 # Sample database connection properties
 #
 db.name=alfresco
 db.username=alfresco
 db.password=alfresco
 db.host=localhost
 db.port=3306
 #
 # External locations
 #-------------
 ooo.exe=/usr/bin/soffice
 ooo.enabled=true
 jodconverter.officeHome=/usr/lib/libreoffice
 jodconverter.portNumbers=8101
 jodconverter.enabled=true
 img.root=/usr
 swf.exe=/usr/bin/pdf2swf
 ffmpeg.exe=/usr/bin/ffmpeg
 #
 # Property to control whether schema updates are performed automatically.
 # Updates must be enabled during upgrades as, apart from the static upgrade scripts,
 # there are also auto-generated update scripts that will need to be executed. After
 # upgrading to a new version, this can be disabled.
 #
 db.schema.update=true
 #
 # MySQL connection
 #
 db.driver=org.gjt.mm.mysql.Driver
 db.url=jdbc:mysql://${db.host}:${db.port}/${db.name}
 #db.driver=org.gjt.mm.mysql.Driver
 #db.url=jdbc:mysql://localhost/alfresco340?useUnicode=yes& amp;characterEncoding=UTF-8
 # ALTER DATABASE alfresco SET ALLOW_SNAPSHOT_ISOLATION ON;
 #
 #db.driver=net.sourceforge.jtds.jdbc.Driver
 #db.url=jdbc:jtds:sqlserver://localhost:1433/alfresco
 #db.txn.isolation=4096
 #PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
 #db.driver=org.postgresql.Driver
 #db.url=jdbc:postgresql://localhost:5432/alfresco

 # Index Recovery Mode
 #-------------
 index.recovery.mode=AUTO

 # Outbound Email Configuration
 #-------------
 #mail.host=
 #mail.port=25
 #mail.username=anonymous
 #mail.password=
 #mail.encoding=UTF-8
 #mail.from.default=alfresco@alfresco.org
 #mail.smtp.auth=false
 #
 # Alfresco Email Service and Email Server
 #-------------
 # Enable/Disable the inbound email service. The service could be used by processes other than
 # the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
 #-------------
 #email.inbound.enabled=true
 # Email Server properties
 #-------------
 #email.server.enabled=true
 #email.server.port=25
 #email.server.domain=alfresco.com
 #email.inbound.unknownUser=anonymous
 # A comma separated list of email REGEX patterns of allowed senders.
 # If there are any values in the list then all sender email addresses
 # must match. For example:
 # .*@alfresco.com, .*@alfresco.org
 # Allow anyone:
 #-------------
 #email.server.allowed.senders=.*
 #
 # The default authentication chain
 # To configure external authentication subsystems see:
 # http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems
 #-------------
 authentication.chain=alfrescoNtlm1:alfrescoNtlm
 # The password for the default principal (only used for LDAP sync)
 #ldap.synchronization.java.naming.security.credentials=secret
 #
 # URL Generation Parameters (The ${localname} token is replaced by the local server name)
 #-------------
 #alfresco.context=alfresco
 #alfresco.host=${localname}
 #alfresco.port=8080
 #alfresco.protocol=http
 #
 #share.context=share
 #share.host=${localname}
 #share.port=8080
 #share.protocol=http
 cifs.enabled=true
 ftp.enabled=true
 cifs.serverName=${localname}
 cifs.hostannounce=true
 imap.server.enabled=false
 #imap.server.port=143
 #imap.server.host=
 # Default value of alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'.
 # This allows connections to JMX both remotely and locally.
 #
 alfresco.rmi.services.host=0.0.0.0
 #
 # RMI service ports for the individual services.
 # These seven services are available remotely.
 # Assign individual ports for each service for best performance
 # or run several services on the same port. You can even run everything on 50500 if needed.
 # Select 0 to use a random unused port.
 #avm.rmi.service.port=50501
 #avmsync.rmi.service.port=50502
 #attribute.rmi.service.port=50503
 #authentication.rmi.service.port=50504
 #repo.rmi.service.port=50505
 #action.rmi.service.port=50506
 #wcm-deployment-receiver.rmi.service.port=50507
 #monitor.rmi.service.port=50508

Stop and start Alfresco:

root@ubuntu1:/opt/alfresco40c#./alfresco.sh stop
root@ubuntu1:/opt/alfresco40c#./alfresco.sh start

Now, It’s Time To Check alfresco and share pages in the browser.

http://your_ipaddress:8080/share
http://your_ipaddress:8080/alfresco

See, if your installation was successful!

Default Login Details For alfresco and share:-
Default username=admin
Default password=admin

  • © 2004-2015 Special Work & Technology Limited