How to enable MySQL/MariaDB remote access

Out of the box, MySQL will only allow access from the localhost address 127.0.0.1. To change this, you need to open the /etc/mysql/mysql.conf.d/mysqld.cnf (mariadb–> /etc/mysql/my.cnf) file and change the line:

~$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 127.0.0.1

to:

bind-address = 0.0.0.0

Save and close that file.

~$ sudo -u root -p

command this:

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘password’;

Restart the MySQL server with the command:

~$ sudo systemctl restart mysql.service

How to install ODK Aggregate on Ubuntu Server

Open Data Kit (ODK) is an open-source suite of tools that helps to Build survey form, Collect data on a mobile device and send it to a server and Aggregate the collected data on a server and extract it in useful formats. ODK Aggregate can be deployed on Google’s App Engine, by creating google account. ODK Aggregate can also be deployed locally on a Tomcat server backed with a MySQL or PostgreSQL database server.

After installation of Tomcat and PostgreSQL you can download ODK installation file as like in our instruction here:

Go for https://opendatakit.org/downloads/ and choose the proper version click download

Then while it downloading click the link

Here it will be

~$ wget https://s3.amazonaws.com/opendatakit.downloads/ODK%20Aggregate%20v1.4.15%20linux-x64-installer.run

 

After it is downloaded type the below command and follow the instruction (please be informed that the version can be deferred) :

~$ sudo chmod +x ODK*.run

~$ sudo ./ODK*.run 

The installer does not install anything, but will guide you through configuring ODK Aggregate for Tomcat and PostgreSQL.

During instruction, you have given a name for a folder for ODK Aggregate war file and other files. I have given ODK name.

~$ cd ODK/ODK*/

~$ sudo cp ODK*.war /opt/tomcat/webapps/

~$ sudo -i -u postgres

Then go to the folder location inside the folder:

postgres@ubuntu: ~$ cd /home/[user_name_for_the_account]/ODK/ODK*

postgres@ubuntu: ~$ psql

postgres=# \i create_db_and_user.sql

postgres=# \q

postgres@ubuntu: ~$ exit

~$ sudo service tomcat restart

now you can browse for   http://[computer_name_or_IP]:8080/ODKAggregate

ODK user name is what you set and password is aggregate

How to Install PostgreSQL on Ubuntu Server 16.04 and Manage

What does PostgreSQL mean?

PostgreSQL is an open-source, object-relational database management system (ORDBMS) that is not owned or controlled by one company or individual. Because PostgreSQL software is open-source, it is managed mostly through a coordinated online effort by an active global community of developers, enthusiasts and other volunteers.

First released in the mid-1990s, postgresSQL is written in C. Its primary competitors include Oracle DB, SQL Server and MySQL.

This term is also known as Postgres.

Installation:

First, let us update the system:

~$ sudo apt-get update && sudo apt-get upgrade

Install PostgreSQL from the Ubuntu package repository:

~$ sudo apt-get install postgresql postgresql-contrib

Change Postgres Linux user’s password
~$ sudo passwd postgres
 To enable remote access you will need to edit two files:
/etc/postgresql/9.5/main/pg_hba.conf
/etc/postgresql/9.5/main/postgresql.conf (9.5 is the version number so it can be various)
~$ sudo nano /etc/postgresql/9.5/main/pg_hba.conf
 Find the below
# IPv4 local connections:
host all all 127.0.0.1/32 md5
and change it as below
# IPv4 local connections:
host all all 0.0.0.0/0 md5
and for second file:
~$ sudo nano /etc/postgresql/9.5/main/postgresql.conf
# listen_addresses=’localhost’ to
listen_addresses=’*’

Switching Over to the postgres Account

The installation procedure created a user account called postgres that is associated with the default Postgres role. In order to use Postgres, we can log into that account.

Switch over to the postgres account on your server by typing:

~$ sudo -i -u postgres
be below command:
~$ psql

You will be logged in and able to interact with the database management system right away.

~$ postgres=#
 Exit out of the PostgreSQL prompt by typing: \q
~$ postgres=# \q
To change the password for a user type below
~$ postgres=# ALTER USER [user_name] with PASSWORD [password];
 Creating a user
~$ sudo -u postgres createuser [user_name]
Create a database
~$ sudo -u postgres createdb [db_name]
Granting a user on a database
~$ postgres=# grant all privileges on database [db_name] to [user_name];

How to install Tomcat 8 on Ubuntu Server 16.04

Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of the latest release of Tomcat 8 on your Ubuntu 16.04 server.

 First step will be to install apt-get-repository by below command

~$ sudo apt-get install software-properties-common

 let us update
~$ sudo apt-get update
The second step is about installing Java. If you want to install Oracle Java then execute the below commands
~$ sudo apt-add-repository ppa:webupd8team/java
~$ sudo apt-get update
~$ sudo apt-get install oracle-java8-installer

Setting as default JDK

~$ sudo apt-get install oracle-java8-set-default

Setting the path globally:

type :

~$ sudo nano /etc/bash.bashrc

and add this line at the end of page.

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

loading bash.bash.bashrc

~$ source /etc/bash.bashrc

The third step is creating tomcat group and user.

~$ sudo groupadd tomcat

~$ sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat

Forth Step is about installing Tomcat

Go to  https://tomcat.apache.org/ click the version you want to download

Then click the mirror if you want to change the download server and click on tar.gz then copy the link address. Here it is http://ftp.itu.edu.tr/Mirror/Apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz

Run the below command

~$  wget http://ftp.itu.edu.tr/Mirror/Apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz

~$ sudo mkdir /opt/tomcat

~$ sudo tar xzvf apache-tomcat-8*tar.gz -C /opt/tomcat

The Fifth step is updating the permission

~$ cd /opt/tomcat

~$ sudo chgrp -R tomcat /opt/tomcat

Next, give the tomcat group read access to the conf directory and all of its contents, and execute access to the directory itself:

~$ sudo chmod -R g+r  conf

~$ sudo chmod g+x  conf

Make the tomcat user the owner of the webapps, work, temp and logs directories:

~$ sudo chown -R tomcat  webapps/ work/ temp/ logs/

The sixth step is about creating a systemd service file

Run the below command first to know where Java is installed

~$ sudo update-java-alternatives -l

It will show something like this

java-8-oracle 1081 /usr/lib/jvm/java-8-oracle

So the java is installed under /usr/lib/jvm/java-8-oracle

~$ echo $JAVA_HOME

If these both are not same then you need to command

~$ sudo nano /etc/bash.bashrc

and add you need to add

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Let us create the systemd service file

~$ sudo nano /etc/systemd/system/tomcat.service

and let us add

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Save and exit

Reload the systemd daemon:

~$ sudo systemctl daemon-reload

Start the Tomcat service :

~$ sudo systemctl start tomcat

Let’s enable the service on boot

~$ sudo systemctl enable tomcat

Step Seven:

If firewall is enabled the allow traffic to 8080 port which tomcat server use by typing:

~$ sudo ufw allow 8080

Let us test the Tomcat server on a browser:

http:// [server_name_or_IP] : 8080

Step Eight:

Configure tomcat web management interface

~$ sudo nano /opt/tomcat/conf/tomcat-users.xml

Now let us add this

<?xml version='1.0' encoding='utf-8'?>

<tomcat-users>
    <role rolename="admin"/>
    <role rolename="admin-gui"/>
    <role rolename="manager-gui"/> 
    <user username="admin" password="password" roles="admin,admin-gui,manager-gui"/>
</tomcat-users>

Generate a username which it is admin here and generate a proper password

We also need to configure context.xml file under

/opt/tomcat/webapps/manager/META-INF/context.xml and /opt/tomcat/webapps/host-manager/META-INF/context.xml

In both file it should be

<Context antiResourceLocking="false" privileged="true" >
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
</Context>

Restart the service by typing:

~$ sudo systemctl start tomcat

Congradulation for the installation of Apache Tomcat!

DBeaver – Open source SQL Editor

DBeaver is an open source universal database tool for developers and database administrators that has a low memory footprint. It supports JDBC compliant databases such as MySQL, Oracle, IBM DB2, PostgreSQL, SQL Server, Firebird, SQLite, and Sybase. Its main features include the ability to browse and edit databases, create and execute SQL scripts, export data, transaction management and ER diagrams. Additionally, DBeaver’s functionality can be extended by the use of plugins.

dbeaver

Main page : http://dbeaver.jkiss.org/

You can check other alternatives as DataGrip and Navicat.

WPS Office for Linux – Community Edition

wpsOffice

WPS Office (an acronym for Writer, Presentation and Spreadsheets, previously known as Kingsoft Office) is an office suite for Microsoft Windows, Linux, iOS and Android OS, developed by Zhuhai-based Chinese software developer Kingsoft. WPS Office is a suite of software which is made up of three primary components: WPS Writer, WPS Presentation, and WPS Spreadsheet.wps

The personal basic version is free to use, but a watermark is printed on all printed output after the 30 day trial ends. A fully featured professional-grade version is also available for a subscription fee. The current version of WPS Office is WPS Office 10.

The product has had a long history of development and success in China under the name “WPS” and “WPS Office”. For a time, Kingsoft branded the suite under the “KSOffice” brand in an attempt to gain a foothold in international markets, but has since returned to “WPS Office”. Since WPS Office 2005, the user interface is similar to that of Microsoft Office products, and supports Microsoft document formats besides native Kingsoft formats.

wps-excel

Download Link–> http://wps-community.org/download.html

How To Install Apache2, MySQL, PHP5 on Ubuntu

apach2php5mysql

Apache is the most commonly used Web server on Linux systems. To install apache, open terminal and type in this command:

sudo apt-get install apache2

then
sudo nano /etc/apache2/apache2.conf
add this at the bottom of page –>  ServerName localhost

To install MySQL, open terminal and type in this command:
sudo apt-get install mysql-server php5-mysql

To install PHP, open terminal and type in this command:
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

It may also be useful to add php to the directory index, to serve the relevant php index files:
sudo nano /etc/apache2/mods-enabled/dir.conf

Change this section as like below one.
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
You can run PHP5 scripts from command line. To run PHP5 scripts from command line you should install php5-cli package with this command: sudo apt-get install php5-cli

Restart apache so that all of the changes take effect:

sudo service apache2 restart

create a new file with this command :

sudo nano /var/www/index.php

and this lines:

<?php

phpinfo();

?>

save it with Ctrl + X and Y.

Then type localhost on your browser.

Oracle Java for Ubuntu and setting JDK for Netbeans

For those who want to install Oracle Java JDK to develop Java programs and applications (the Oracle Java JRE is also included in the Oracle JDK) use this method:

Open your terminal and type:

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Setting as default JDK

sudo apt-get install oracle-java8-set-default

Setting the path globally:

type : sudo nano /etc/bash.bashrc  and add this line at the end of page.

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

loading bash.bash.bashrc

source /etc/bash.bashrc

Now you have to configure Netbeans to use this JDK or run Netbeans with

cd /usr/local/netbeans-8.1/etc or /usr/share/netbeans/8.1/etc (this is for version 8.1)

sudo nano netbeans.conf and change the line netbeans_jdkhome=”/usr” as below

netbeans_jdkhome=”/usr/lib/jvm/java-8-oracle/”