How To Install MySQL on Embedded FreeNAS ?

FreeNAS Logo

Step 1

Create a new group.

Open your FreeNAS WebGUI -> Access -> Users and Groups -> Groups.

Create a new group whose name is mysql.

Step 2

Create a new user.

Open your FreeNAS WebGUI -> Access -> Users and Groups -> Users.

Create a new user, with the following details:-

Name: mysql

Shell: nologin

Primary group: mysql

Step 3

SSH into your FreeNAS as root.

Create a new folder where your packages will be saved, e.g. the new folder name will be pkg and it is under the /mnt/disk1/Services/.

Set the permission of the folder into777.

We will call this folder as BASEDIR.

mkdir /mnt/disk1/Services/pkg

chmod -R 777 /mnt/disk1/Services/pkg

Step 4

Create another folder to hold temporary files during package installation, e.g. folder name is tmp and it is under /mnt/disk1/.

Set the permission of the folder into 777.

Assign mysql user and group as the owner.

mkdir /mnt/disk1/tmp

chmod -R 777 /mnt/disk1/tmp

chown -R mysql:mysql /mnt/disk1/tmp

Step 5

Create a folder for the database files, e.g. the folder name is db/mysql and located in/mnt/disk1/Services/.

Set the permission of the folder into 777.

Assign mysql user and group as the owner.

We will call this folder as DATADIR.

mkdir /mnt/disk1/Services/db

mkdir /mnt/disk1/Services/db/mysql

chmod -R 777 /mnt/disk1/Services/db

chown -R mysql:mysql /mnt/disk1/Services/db

Step 6

Check your FreeNAS version by running this command:-

uname -a

Once, you ran the command, you will get the output as shown below.

The output tells us that the system is running under FreeBSD 9.0-RELEASE on x64 architecture.

Step 7

Get the URL for the package site based on your system, the URL format:-

ftp://ftp.freebsd.org/pub/FreeBSD/ports/<ARCHITECTURE>/<SYSTEM_VERSION>/Latest/

You might go to ftp://ftp.freebsd.org/pub/FreeBSD/ports to check for the correct URL.

For example the URL of my system would be:-

ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/

Step 8

Run the following command to set the package site for your system. The package site URL is based on the URL that you got from Step 7.

setenv PACKAGESITE<THE_PACKAGE_SITE_URL>

Thus, the command for my system would be:-

setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/

Step 9

Set the folder that has been created before on Step 4 as a temporary directory.

setenv PKG_TMPDIR /mnt/disk1/tmp

Step 10

Install mysql into your packages destination folder that has been created before on Step 3.

pkg_add -r mysql55-server -P /mnt/disk1/Services/pkg

Step 11

Open the my-small.cnf:-

nano /mnt/disk1/Services/pkg/share/mysql/my-small.cnf

  1. Edit the Socket, declare the path to where you want your mysql.sock to be saved.
  2. Add the User and declare it as mysql

[client]
socket          = /mnt/disk1/tmp/mysql.sock
[mysqld]
user            = mysql
socket          = /mnt/disk1/tmp/mysql.sock

Save it as my.cnf.

Move it into etc folder under your BASEDIR.

mv /mnt/disk1/Services/pkg/share/mysql/my.cnf /mnt/disk1/Services/pkg/etc/my.cnf

Step 12

Open and edit mysql.server.

Add the path of BASEDIR and DATADIR on the following basedir and datadir variable in mysql.server.

nano /mnt/disk1/Services/pkg/share/mysql/mysql.server

basedir=/mnt/disk1/Services/pkg
datadir=/mnt/disk1/Services/db/mysql

Save it.

Step 13

Create an empty file, mysql_log, on /mnt/disk1/ as a log file for the mysql daemon.

nano /mnt/disk1/mysql_log

Save it.

Step 14

We need to create necessary symlinks with our system, thus you need to create a script with the content as followed:-

#!/bin/sh#Custom Library Symlinks
ln -s /mnt/disk1/Services/pkg/lib/* /usr/lib

#Symlinks Bin
ln -s /mnt/disk1/Services/pkg/bin/* /usr/local/bin

#MySQL Symlinks
ln -s /mnt/disk1/Services/pkg/libexec/mysqld /usr/local/libexec/mysqld
ln -s /mnt/disk1/Services/pkg/etc/my.cnf /etc/my.cnf

You might change the script based on where you installed the packages.

Save the script

For example, my script is saved as hooks.sh and then we need to set the permission of the script to be executable:-

chmod +x /mnt/disk1/script/hooks.sh

Run the script.

/mnt/disk1/script/hooks.sh

Step 15

Once you ran the script above, it will create necessary symlinks with your system.

If your script above ran without problem, you might able to run the command below:-

mysql_install_db –user=mysql –basedir=/mnt/disk1/Services/pkg –datadir=/mnt/disk1/Services/db/mysql

You might change the basedir and datadir paths according to your system.

Step 16

Run the mysql daemon with the following command:-

mysqld_safe –user=mysql –basedir=/mnt/disk1/Services/pkg –datadir=/mnt/disk1/Services/db/mysql

Step 17

Check your whether your MySQL is running by run this command:-

/mnt/disk1/Services/pkg/share/mysql/mysql.server status

If your MySQL is running, you might find the output as shown below:-

Furthermore, you will be able to run the MySQL by calling the mysql command.

Step 18

To run the MySQL automatically during boot time, add the following line to hooks.sh, which have been created before on Step 14.

echo `date` `/mnt/disk1/Services/pkg/share/mysql/mysql.server start` >> /mnt/disk1/mysql_log

Open your FreeNAS WebGUI, go to System —> Advanced —> Command scripts.

Add the script that you have created before on Step 9 on the command field:-

/mnt/disk1/hooks.sh

Select the type as PostInit.

How to Install WGET on Embedded FreeNAS ?

FreeNAS Logo

Step 1

Login as root to your FreeNAS.

Step 2

Create a directory for packages on your data partition of FreeNAS. For example, the data partition is called disk1 and I am going to create a folder, called pkg for the packages. Then the command is:-

mkdir /mnt/disk1/pkg

Create a directory as a temporary folder, for example the directory name is tmp and located in disk1.

mkdir /mnt/disk1/tmp

Step 3

Change the permission of that folders into 777.

chmod -R 777 /mnt/disk1/pkg

chmod -R 777 /mnt/disk1/tmp

Step 4

Check your FreeNAS version by running this command:-

uname -a

Once, you ran the command, you will get the output as shown below.

The output tells us that the system is running under FreeBSD 9.0-RELEASE on x64 architecture.

Step 5

Get the URL for the package site based on your system, the URL format:-

ftp://ftp.freebsd.org/pub/FreeBSD/ports/<ARCHITECTURE>/<SYSTEM_VERSION>/Latest/

You might go to ftp://ftp.freebsd.org/pub/FreeBSD/ports to check for the correct URL.

For example the URL of my system would be:-

ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/

Step 6

Run the following command to set the package site for your system. The package site URL is based on the URL that you got from Step 5.

setenv PACKAGESITE<THE_PACKAGE_SITE_URL>

Thus, the command for my system would be:-

setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/

Step 7

Set the folder that has been created before on Step 2 as a temporary directory.

setenv PKG_TMPDIR /mnt/disk1/tmp

Step 8

Install WGET to your packages directory that has been set before onStep 2.

pkg_add -r wget -P /mnt/disk1/pkg

Step 9

Once the installation is finished, we need to create symlinks of the WGET with our system, thus you need to create a script with the content as followed:-

#!/bin/sh

#Custom Library Symlinks
ln -s /mnt/disk1/pkg/lib/* /usr/lib

#WGET
ln -s /mnt/disk1/pkg/bin/wget /usr/bin/wget

You might change the script based on where you installed the WGET.

Save the script

For example, my script is saved as hooks.sh and then we need to set the permission of the script to be executable:-

chmod +x /mnt/disk1/hooks.sh

Run the script.

Step 10

In order to re-create the symlinks after reboot, open your FreeNAS WebGUI, go to System —> Advanced —> Command scripts.

Add the script that you have created before on Step 9 on the command field:-

/mnt/disk1/hooks.sh

Select the type as PostInit.

Step 11

Test your WGET, if everything is okay, you should see the output as shown below, when you run the WGET.

How to Solve UnRAR Problem on RapidLeech ?

FreeNAS LogoRapidLeech Logo

First, this post is only related with RapidLeech that is host on a FreeBSD / FreeNAS.

Standard RapidLeech comes with a UnRAR and RAR functionality, since I am hosting my RapidLeech under FreeBSD system, every time I want to UnRAR, I always encounter this error message:-

===rar executable info===
unrar 3.80 for Linux with permissions 0777
===Return code===
126
===Error===
/mnt/disk1/Services/Web/rar/unrar: Exec format error

===rar executable info===
Unknown rar executable(211648 bytes md5:358a1512e849a77cc44141439f3e0013) with permissions 0777
===Return code===
6

The first error message tells that the RAR binary does not match with your operating system. While, the second error tells there is something missing, such as library.

Thus, to solve that kind of problem:-

Step 1

Download the latest RAR for FreeBSD from here.

Step 2

Copy and paste the rar,unrar, and rar_static files into your RapidLeech rar folder.

You might use WinSCP, to upload those files.

Step 3

Log in to your server.

Change the permission of the whole rar folder into 777.

The command is chmod -R 777 rar/

You could do this by using PuTTY or WinSCP.

Step 4

You should be able to unrar your files by now.

If you still unable to unrar your files and encounter the same error.

Delete that rar file from the rar folder and rename the rar_static into rar.

How to Configure Google OpenDNS on Innacomm W3400V ?

DNS LogoIn the computer network term, Domain Name System (DNS) is used to resolve the host name into an IP address. E.g. you open your browser and you want to browse google.com. Once you typed in google.com into you browser, the DNS will start its job. The DNS will send a DNS request to the DNS server, it requests the IP address of the google.com to the DNS server. It was merely like your computer asking the DNS server “Hi DNS server, I need to go to google.com, could you tell me what is the IP address of google.com ?”. Then, the DNS server will reply, “Hi there, the IP address of google.com is 179.56.72.89.” Thus, after your computer knew what is the IP address of google.com, it know where to go.

Normally, the DNS server addresses is automatically provided by the ISP. Thus, the ISP could control some websites that they want to block. They could control which website that you can go into and which website that is restricted. Some of the common blocked websites are porn sites, torrent site, and warez sites. Even though, this feature offers good things. But, sometimes you do not want to be restricted.

One of the trick to be unrestricted is by simply use another DNS server. There are a lot of parties that offering the DNS services, such as OpenDNS and Google. Some of those providers will charge you for the services. While, if you want to use a reliable and free DNS service, Google OpenDNS really will do. If you would like to know further about Google OpenDNS, you should check their official site here.

Advantages of using Google OpenDNS are:-

  1. Totally FREE.
  2. Speed up your browsing experience.
  3. Improve security by preventing several attacks such as Denial-of-Service (DOS) attacks and DNS cache poisoning.
  4. Gain access to the websites that is blocked by your ISP.

FYI, Google OpenDNS addresses are 8.8.8.8 and 8.8.4.4.

If you want to use Google OpenDNS you could either set it up on your computer’s network configuration or on your router directly. If you just set it up on your computer, that means only your computer alone that will gain the advantages of using the Google OpenDNS. While, if you set it up on your router’s configuration, every single computer that is connected to the router will also gain the advantage of using Google OpenDNS. Thus, if you have hundreds of computer that is connected to the router, all computer will automatically use the Google OpenDNS as their DNS server, but it only applicable if the DHCP is enabled.

In this post, I will specifically talk about how to configure the Google OpenDNS on the Innacomm W3400V routers.

Step 1

  • Ensure that you were connected to the router.
  • Open a web browser and go to the router’s management console, the default address is http://192.168.1.1.

    Innacomm Login Page

  • Log in to the router’s management console by using tmadmin credentials.

Step 2

  • Go to Advanced Setup > DNS > DNS Server.
  • Tick on the Use the following Static DNS IP address.
  • Fill in the Google OpenDNS address on the Primary and Secondary DNS server fields.
  • Then click Save/Apply.

Innacomm W3400V OpenDNS

How to Connect to A Non-standard TCP/IP Port from SQL Server Management Studio ?

SQL Server Logo

Sometimes, you need to connect to  named-instance database remotely. E.g. you have a named-instance database called mydatabase. If you had access to the server directly, then there won’t be any problem. But, the problem arise when you do not have access to the server. Then, it got worse since the server running multiple instances of database, where each instance is assigned to a non-standard TCP/IP port on the server.

What you need to connect to the named-instance database from SQL Server Management Studio are:-

  1. The database server’s IP address or host name e.g. thedatabaseserver.
  2. The instance’s name of the named-instance database e.g. mydatabase.
  3. The TCP/IP port’s number of the database instance.The default instance TCP/IP port is 1433. But, let’s say the port of our destined database is 41433.

The format is:-

<DATABASE_SERVER_IP_ADDRESS>\<INSTANCE_NAME>,<PORT_NUMBER>

E.g.

thedatabaseserver\mydatabase,41443

So, to connect to the remote database server by using SQL Server Management Studio (SSMS):-

  1. Open your SSMS.
  2. Specify the server name of the server name field by following the above format. E.g. type-in the thedatabaseserver\mydatabase,41443.
  3. Specify the credentials to log in to the server.
  4. Click Connect and voila you were connected remotely to your database server.

SSMS

If you still cannot gain access to the server, please check the following:-

  1. Ensure that the database server’s IP address or host name is correct.
  2. Ensure that the database instance’s name is correct.
  3. Ensure that the port number is correct. You might check with the database administrator about this one, if you do not have access to the server.
  4. Ensure that the credentials that you keyed-in are correct. Please check the username and password again.

How to Add VectorWise JDBC in JasperServer ?

JasperServer Logo

Step 1

Step 2

  • Extract the Ingres / VectorWise JDBC Driver.

Step 3

  • Copy the JAR file, e.g. iijdbc.jar to your installation directory, by default is:

C:\Program Files\jasperreports-server-4.5\apache-tomcat\webapps\jasperserver-pro\WEB-INF\lib

Step 4

  • Restart JasperServer, there is a shortcut in the start menu to restart it.

Step 5

  • Log in to your JasperServer‘s website, http://<YOUR_SERVER>/jasperserver-pro e.g. http://localhost:8080/jasperserver-pro
  • Log in as administrator / superuser, by default:
    • Username: superuser
    • Password: superuser

Step 6

  • Go to Home > Manage Server > Repository.
  • Right-click on the designated folder, Add Resource > Data Source.

JasperServer

Step 7

  • Select the type as JDBC Data Source.
  • Specify the Name.
  • The Resource ID will be filled in automatically when the Name is specified. You might change it, if necessary.
  • Specify the Driver as com.ingres.jdbc.IngresDriver
  • Specify the URL by following this format:

    jdbc:ingres://<DB_IP_ADDRESS>:<VECTORWISE_PORT>/<DB_NAME>

    • Please read this post to get the VectorWise Port.
    • e.g. jdbc:ingres://localhost:VX7/my_database
  • Specify the username and password.
  • Test the connection by clicking the Test Connection.

JasperServer

Step 8

  • If the connection test returns successful, you might save the Data Source by clicking Submit button.

ODBC Connection Success

  • If it does not return successful, you might try to restart the JasperServer.

 

How to Create VectorWise JDBC Connection in Jaspersoft iReport ?

 

 

 

 

 

 

 

 

Step 1

  • Download Ingres / VectorWise JDBC Driver from Actian Official Page.
  • Install the Ingres / VectorWise JDBC Driver  to your Jaspersoft iReport, please read here.

Step 2

  • Click the Report Datasources icon on toolbar.

  • On the Connections / Datasources window, click New.

  • Select Database JDBC Connection and then Next.

Step 3

  • Specify the Name for this datasource on the name field.
  • Select Ingres on the JDBC Driver list. If you have successfully added the JDBC driver, the Ingres JDBC Driver will be listed in black color instead of red.

  • JDBC URL format :

jdbc:ingres://<DB_IP_ADDRESS>:<VECTORWISE_PORT>/<DB_NAME>

  • <DB_IP_ADDRESS> – You have to specify the IP address of the database server, if your database is on the same machine, you can specify it as localhost.
  • <VECTORWISE_PORT>
    • For Unix machine, run this command on terminal: iigetres ii.`<YOUR_HOSTNAME>`.gcd.*.tcp_ip.port
    • For Windows machine, run this command Windows command processor: iigetres ii.<YOUR _HOSTNAME>.gcd.*.tcp_ip.port
    • E.g. iigetres ii.mypc.gcd.*.tcp_ip.port
    • Those command will return the vectorwise port name e.g. VW7.

  • <DB_NAME> – Specify your database name e.g. mydatabase.
  • Specify the user credential to access the database on username and password fields.
  • Click Test to test the connection.

Step 4

  • If the Test connection returns successful, you might Save that connection.

  • Close the Connections / Datasources window.

Now you can start creating reports by using data from VectorWise.

JDK 5.0 or newer cannot be found on your machine

If the error below appeared on your computer when you ran Jaspersoft iReport, that means you do not have Java Development Kit (JDK) installed in your computer. Since, the iReport is a Java-based application.

To solve the ‘JDK 5.0 or newer cannot be found on your machine.’ error:-

Step 1

  • Download the latest JDK from Oracle website.
  • For Windows 64 bit user, you have to download the JDK for Windows 32 bit. Otherwise, it will not work.
  • You can google ‘JDK’ to get the link to JDK download page or click here.

Step 2

  • Once the JDK is downloaded, you might install the JDK into your machine.
  • Ensure that you also select the Public JRE to be installed.

Now you can run your Jaspersoft iReports without getting ‘JDK not found’ error message anymore.

Thank you.

How to Add A New JDBC Driver in Jaspersoft iReport ?

 

 

 

 

 

 

 

 

 

In this post, I will elaborate the steps to add a new JDBC driver in Jaspersoft iReport:-

Step 1

  • Download the JDBC driver. E.g. VectorWise JDBC.

Step 2

  • Open Jaspersoft iReport.
  • Go to Tools > Options > iReport

  • Click Classpath tab.
  • Click Add JAR, browse and select the JDBC JAR file
  • Once the JDBC JAR file is added, click OK.

Now, you have a new JDBC driver added inside your Jaspersoft iReport. To check whether the newly added JDBC driver is working, you can try to add a new data source based on that JDBC driver.

How to Setup RapidLeech on FreeNAS ?

How to Setup RapidLeech on FreeNAS ?

FreeNAS LogoRapidLeech Logo

With the functionality of rapidleech, you can have your own download server on your Network Attached Storage (NAS).

Step 1

  • Download the rapidleech from the Google code page of rapidleech here.
  • Extract the zip file of the rapidleech.

Step 2

  • Create a folder on your FreeNAS server, you can name it anything, e.g. Web.
  • Ensure that you set full permission, 777,  for that folder.
  • Copy all the rapidleech codes that you have downloaded before.
  • For Windows user, if you have not setup samba service on your FreeNAS, you can do it easily by using WinSCP.

Step 3

  • Open your FreeNAS WebGUI.
  • Go to Services > Web Server.
  • Tick the Enable option.
  • Select the protocol either HTTP or HTTPS.
  • Specify the port, by default the port for HTTP is 80 and for HTTPS is 443. You have to ensure that this port has not been used for any services on your FreeNAS server.
  • Click the ellipsis on the Document Root to browse and select the folder that you have created on Step 2.
  • Click Save and Restart.

Step 4

  • Open your rapidleech on a web browser, by type in your FreeNAS IP address or URL followed by port number that you have set on Step 3, http://<freenas_address&gt;:<port_number>, e.g. http://192.168.1.200:20080.
  • If everything works just fine, the initial configuration of rapidleech will be displayed.
  • You can go through the configuration and make configuration changes, if needed.
  • Click Save Configuration.