Posts

Showing posts with the label Ubuntu

How to set ant_opts in ubuntu

Edit ~/.bashrc Open terminal and execute> $ sudo gedit .bashrc Above command open .bashrc file in edit mode. Now add the below two lines: ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" export ANT_OPTS Now save the file and close terminal. Enjoy......

How disable anonymous access to MongoDB OR Enable Client Access Control in MongoDB.

Securing MongoDB with Authentication and Authorization: Step 1) Login using shell and Create an admin account: Open terminal and login using below command>  mongo  Switch to admin db using below command> use admin;    Create Admin user using below command> db.createUser({ user : "admin", pwd : "pass", roles: [ { role: 'root', db: 'admin' } ] });   Now Give grand Roles to Admin User using below command:   db.grantRolesToUser( " admin ", [{ "role" : "readWriteAnyDatabase", "db" : "admin" },{ role: "userAdminAnyDatabase", db: "admin" }] ) Step 2) Test your admin account using below command> mongo -u admin -p pass --authenticationDatabase admin   Step 4) Force authorization  FOR MONGODB 3.0 AND ABOVE add these lines in /etc/mongod.conf>  security:   authorization: enabled FOR MONGO...

How to install mongodb in ubuntu 15.04

Step 1: If you install any packages of mongodb yet, firstly remove all. To remove all existing packages execute the below command: sudo apt-get purge mongodb-org sudo apt-get autoremove Remove the old mongodb source list you created in below folder. sudo rm /etc/apt/sources.list.d/   Remove db and logs: sudo rm -r /var/lib/mongodb sudo rm -r /var/log/mongodb Step 2: Add debian repository: echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" |  sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list   Step 3: Update and install: sudo apt-get update sudo apt-get install -y mongodb-org Step 4: Start mongo db: sudo service mongod start or systemctl start mongod  Step 5: Configure MongoDB username and password: open mongo shell : (cntrl+alt+t) open termianl and type > mongo   then the shell is open. then switch the database typing> use admin then Create the r...

Reverse-Proxy in apache2.

Follow the below blog. How To Use Apache HTTP Server As Reverse-Proxy Using mod_proxy Extension.

Set Up Apache Virtual Hosts on Ubuntu.

Prerequisites: You have to install apache2 in your os. For this follow my previous blog Install apache2 in Ubuntu.   Step 1: Create new host. Open terminal(ctrl+alt+t) and paste below code > sudo gedit /etc/hosts Now edit the file. Means add new host name and port.Example add below line > 127.0.1.1    example.com Now save and close the file. Step 2: Create the Directory Structure. Create new folder in /var/www/    directory . For this execute the below line> sudo mkdir -p /var/www/ example.com /public_html   Step 3:  Grant Permissions.Now change permissions to enable regular user to modify files in our web directories. For this execute the below line> sudo chown -R $USER:$USER /var/www/ example.com /public_html   We should also modify our permissions a little bit to ensure that read access is permitted to the general web directory. For this execute the below line > sudo chmod -R ...

How to run ofbiz as ubuntu Service.

Apache Ofbiz developer need write script to start and stop ofbiz server as Ubuntu service. In my projects production and test server management i need this, and after spending few times  i got this. Here below i share my experience. The script code given below. #!/bin/bash -e ### BEGIN INIT INFO # Provides:          ofbiz # Required-Start:    $syslog $time $remote_fs # Required-Stop:     $syslog $time $remote_fs # Default-Start:     2 3 4 5 # Default-Stop:      0 1 6 # Short-Description: start Apache Ofbiz # Description:       Debian init script for the Apache Ofbiz, #                    the open source enterprise automation software ### END INIT INFO set -e ############################################################...

Install apache2 in Ubuntu.

sudo apt-get update sudo apt-get install apache2 Restart apache so that all of the changes take effect: sudo service apache2 restart

How to enable cross origin in apache.

Step 1: To enable cross origin in apache2 you need enable mod_headers . To ensure that it's enabled by run below command in terminal. a2enmod headers   Step 2: Next add the following line inside the sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file.   Go to /etc/apache2   Then copy paste the below line: sudo gedit apache2.conf Add below lines: <IfModule mod_headers.c> Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, PUT, DELETE" Header always set Access-Control-Allow-Headers "access-control-allow-origin, authorization,content-Type,x-requested-with,accept,origin,access-control-request-method,access-control-request-headers" </IfModule> Finally save the apache2.conf file and reload the apache service running below code:   sudo service apache2 reload   Enjoy.. ...

Create git branch and delete branch.

Create the branch on your local machine and switch in this branch : $ git checkout -b [name_of_your_new_branch] Push the branch on github : $ git push origin [name_of_your_new_branch] switch to new branch or master $ git checkout [branch name] Delete a branch on your local filesystem :   $ git branch -d [name_of_your_new_branch]   delete branch from server $ git push origin :[name_of_your_new_branch] Enjoy!!!

How To Install Git with Apt in ubuntu.

To install git in Ubuntu you can use apt package management tools. Open terminal (ctrl+alt+t) and paste the bellow commands. sudo apt-get update sudo apt-get install git  Enjoy.........

Run open office as service in Ubuntu.

First You have to create a service for start openoffice. I have created a service under /etc/init.d it called OpenOffice. Script looks like #!/bin/bash     ### BEGIN INIT INFO # Provides:          dovecot # Required-Start:    $local_fs $network # Required-Stop:     $local_fs # Default-Start:     2 3 4 5 # Default-Stop:      0 1 6 # Short-Description: dovecot # Description:       dovecot pop & imap daemon ### END INIT INFO     # openoffice.org headless server script     #     # chkconfig: 2345 80 30     # description: headless openoffice server script     # processname: openoffice     #     # Author: Vic Vijayakumar     # Modified by Federico Ch. Tomasczik     #   ...

Service Script for LifeRay on Ubuntu

Liferay developer need write script to start and stop liferay as service. In my projects production and test server management i need this, and after spending few times  i got this. Here below i share my experience. The script code given below. #!/bin/bash # # tomcat     This shell script takes care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN INIT INFO # Provides: tomcat # Required-Start: $network $syslog # Required-Stop: $network $syslog # Default-Start: # Default-Stop: # Short-Description: start and stop tomcat ### END INIT INFO #TOMCAT_HOME="/home/tariq/projects/projects/bundles/tomcat-7.0.42" TOMCAT_HOME="Home of your liferay tomcat" SHUTDOWN_WAIT=45 tomcat_pid() { #filter running process, here you can add extra filter criteria by adding | grep #criteria text     echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'` } start() {     pid=$(...