Friday, September 26, 2014

Fails Fetch When Update Ubuntu - apt-get update

Got problem when update ubuntu

apt-get update

Error Message

dists_precise_restricted_source_Sources Hash Sum mismatch

This is what i try and it success.

sudo -i
apt-get clean
cd /var/lib/apt
mv lists lists.old
mkdir -p lists/partial
apt-get clean
apt-get update
exit

Wednesday, August 6, 2014

Command Ubuntu Part 3 - Link Folder Secara Symbolic Link Dalam Ubuntu

Apa itu symbolic link atau symlink ?

Ianya merupakan satu fail yang mengandungi rujukan ke file atau directory ditempat lain.
Ianya wujud sejak tahun 1978 dalam OS DEC dan RDAS. Ianya banyak digunakan dalam GNU/Linux, FreeBSD dan MacOS. Sementara dalam Windows (XP , 7 dsbnya) ianya dikenali sebagai shortcut.

Ada dua jenis symlink:

Iaitu hard dan soft. Soft symlink adalah seperti shortcut dalam windows XP. Apabila kita membuka softlink ia akan arahkan pada folder tempat file asal disimpan.

Sementara itu bagi hard link, file atau folder yang dimaksud ada di lokasi hard link seperti  file berada di lokasi yang sama dengan hard link. 

Kegunaan 
  • Memudahkan akses sesuatu fail dari lokasi yang berbeza - erm ... mmg best kalau dalam console tak yah nak taip panjang2 setiap kali nak akses file/directory.
  • Data mudah diuruskan kerana ianya berada dalam satu folder dan hanya akses melalui symlink yg diwujudkan.
  • Menjimatkan ruang hard disk kerana tidak perlu meng-copy file dari lokasi asal ke lokasi yang lebih mudah di akses.
Caranya

ln -s folder_asal  lokasi_shortcut

1:  sudo ln -s /home/ali/webapp /var/www/webapp  

Monday, July 14, 2014

Command Ubuntu - Part 2

Create fail cara command line

Untuk create boleh gunakan command

touch namafail

touch Readme.txt

atau create file dan terus masuk teks tanpa gunakan teks editor

echo "Tutorial untuk Laravel" >> Readme.txt

Memasukan user kedalam sudo file

Bagi membolehkan user yang kita add dalam ubuntu mengunakan sudo atau user selain daripada root guna sudo kita kena reconfig file sudo yang mengandungi permission bagi sesiapa yang boleh menggunakan arahan sudo.
Ini penting kerana tidak semua user boleh menggunakan arahan sudo yg membolehkan seseorang itu mengemaskini atau menjalankan sesuatu arahan seperti yg digunakan user root/admin.
Hanya admin/root sahaja yg boleh memasukan user lain dalam file sudo.
Login as root or su to get root prompt.
type visudo
an editor will open find a line says
root ALL=(ALL) ALL
add one with your username below that
user ALL=(ALL) ALL


Wednesday, July 2, 2014

Tambah User dalam Ubuntu 12.04LTS

Sumber Asal - http://manpages.ubuntu.com/manpages/precise/id/man8/useradd.8.html

NAME

       useradd  -  Membuat  user  baru atau memperbarui informasi tentang user
       baru

SYNOPSIS

       useradd [-c comment] [-d home_dir]
               [-e expire_date] [-f inactive_time]
               [-g initial_group] [-G group[,...]]
               [-m [-k skeleton_dir] | -M] [-s shell]
               [-u uid [ -o]] [-n] [-r] login

       useradd -D [-g default_group] [-b default_home]
               [-f default_inactive] [-e default_expire_date]
               [-s default_shell]

PENJELASAN

   Membuat User Baru
       Jika digunakan tanpa option -D,  perintah  useradd  menciptakan  sebuah
       user  account  baru  dengan  menggunakan nilai yang terdapat pada baris
       perintah dan  nilai  default  dari  system.   User  account  yang  baru
       tersebut  akan  dimasukkan  ke  system files seperlunya, home directory
       akan dibuatkan, dan initial files di-copy-kan, tergantung  option  yang
       terdapat  pada  baris perintah.  Versi yang terdapat pada Red Hat Linux
       akan membuat sebuah group  untuk  setiap  user  yang  didaftarkan  pada
       system,  jika  -b  tidak  diberikan.   Option yang dapat digunakan pada
       perintah useradd adalah

       -c comment
              Komentar pada file password milik user baru.

       -d home_dir
              User  baru  akan  diciptakan  dengan  home_dir  sebagai   lokasi
              directory  login-nya.  Default-nya adalah menambahkan nama login
              pada default_home  dan  menggunakannya  sebagai  nama  directory
              login.

       -e expire_date
              Tanggal  ketika  user  account dimatikan.  Tanggal ditulis dalam
              format MM/DD/YY.

       -f inactive_days
              Jumlah hari setelah sebuah password  kadaluarsa  hingga  account
              tersebut  dimatikan  secara permanen.  Nilai 0 mematikan account
              segera setelah  password  kadaluarsa,  dan  nilai  -1  mematikan
              fungsi ini.  Nilai default-nya adalah -1.

       -g initial_group
              Nama  group  atau  angka  initial login group.  Nama group harus
              sudah ada.  Seorang anggota group harus merujuk pada group  yang
              sudah ada.  Nilai group default-nya adalah 1.

       -G group,[...]
              Daftar  group  tambahan  yang  juga  merupakan  group-nya  user.
              Setiap group dipisahkan oleh koma, tanpa diikuti  spasi.   Group
              juga   mengikuti   aturan   yang  diberikan  dengan  option  -g.
              Default-nya hanyalah untuk user yang terdaftar pada group awal.

       -m     Home directory milik user akan dibuatkan jika belum  ada.   File
              yang  terdapat  pada  skeleton_dir atau /etc/skel akan dibuatkan
              pada home directory milik user.   Option  -k  hanya  valid  jika
              bertemu  option  -m.  Dafault-nya adalah tidak membuat directory
              dan tidak meng-copy segala file.

       -M     Home directory milik user  tidak  akan  dibuatkan,  bahkan  jika
              setting system pada /etc/login.defs ditujukan untuk membuat home
              directory.

       -n     Sebuah group yang namanya sama dengan user akan  ditambahkan  ke
              dalam   system   secara  default.   Option  ini  akan  mematikan
              kebiasaan tersebut yang terdapat pada Red Hat Linux.

       -r     Flag ini digunakan untuk membuat sebuah system account.   Yaitu,
              user  dengan  UID  yang  lebih kecil dari UID_MIN yang tercantum
              pada /etc/login.defs.  Harap diingat bahwa  useradd  tidak  akan
              membuat  home  directory  untuk  user  semacam ini, menghiraukan
              setting default yang terdapat di  /etc/login.defs.   Anda  harus
              menyebutkan  option  -m  jika ingin membuat home directory untuk
              sebuah system account yang akan dibuat.  Ini adalah option  yang
              ditambahkan oleh Red Hat.

       -s shell
              Nama  login  shell  milik  user.   Default-nya adalah membiarkan
              field ini kosong, yang menyebabkan system  untuk  memilih  login
              shell yang default.

       -u uid Nilai  user  ID secara numerik.  Nilai ini harus unique, kecuali
              jika option -o digunakan.  Nilai tersebut tidak  boleh  negatif.
              Default-nya  adalah  menggunakan  nilai ID yang lebih besar dari
              999 dan lebih besar dari semua user lain.  Nilai di antara 0 dan
              999 biasanya disiapkan untuk system aacount.

   Mengubah nilai-nilai default.
       Ketika  digunakan  dengan  option  -D,  useradd  akan menampilkan nilai
       default, atau memperbarui nilai default baru yang terdapat  pada  baris
       perintah.  Option yang dapat digunakan adalah

       -b default_home
              Awalan  path  untuk  home  directory milik user baru.  Nama user
              akan ditambahkan setelah akhir default_home ketika membuat  nama
              directory  baru  jika  option  -d tidak disebutkan dalam membuat
              account baru.

       -e default_expire_date
              Tanggal ketika user account dimatikan.

       -f default_inactive
              Jumlah  hari  setelah  password   kadaluarsa   sebelum   account
              dimatikan.

       -g default_group
              Nama  group  atau  ID  sebagai group awal user baru.  Nama group
              yang disebut harus sudah ada dan nomor group ID harus  mempunyai
              entry.

       -s default_shell
              Nama  untuk  login  shell  milik  user  baru.  Nama program yang
              disebutkan  akan  digunakan  untuk  semua  user   account   baru
              mendatang.

       Jika  tidak  ada  option  yang  disebutkan,  useradd  menampilkan nilai
       default yang ada saat ini.

NOTES

       The system administrator is responsible for placing  the  default  user
       files in the /etc/skel directory.
       Versi useradd ini dimodifikasi oleh Red Hat agar cocok dengan ketentuan
       mengenai user/group.

CAVEATS

       Anda tidak dapat menambahkan user pada grou NIS.  Ini  harus  dilakukan
       pada server NIS.

FILES

       /etc/passwd - informasi tentang user account
       /etc/shadow - informasi user account yang terlindung
       /etc/group - informasi tentang group
       /etc/default/useradd - informasi tentang nilai default
       /etc/login.defs - system-wide settings
       /etc/skel - directory yang mengandung default files

LIHAT JUGA

       chfn(1),  chsh(1),  groupadd(8),  groupdel(8),  groupmod(8), passwd(1),
       userdel(8), usermod(8)

AUTHOR

       Julianne Frances Haugh (jfh@tab.com)

Wednesday, April 23, 2014

Tutorial Java Glassfish Netbeans MySQL

Configure the connection pool in Glassfish


Copy the MySQL connector jar file into /lib folder
Start Glassfish server (or restart it if it was already running

Once Glassfish is installed you will need to make sure it can access MySQL Connector/J. 

To do this copy the MySQL Connector/J JAR file to the directory GLASSFISH_INSTALL/glassfish/lib

For example, copy mysql-connector-java-5.1.12-bin.jar to C:\glassfishv3\glassfish\lib


Restart the Glassfish Application Server
Now we need to navigate to the administrator application:
http://localhost:4848/
  
Open the 'Resources' -> 'JDBC' -> 'Connection Pools' and select 'New'.
Fill in the Connection Pool 'Name' with a suitable name like MySQLPool.
Select 'Resource Type' : 'javax.sql.DataSource'.
Select 'Database Vendor' : 'MySQL'.
Select 'Next'.

At the next page go down at the additional Properties.
Find and edit the following properties :
Fill in property 'User' with the 'Value' : {db_user}
Fill in property 'Password' with the 'Value' : {db_user_pass}
Fill in property 'URL' with the 'Value' :
jdbc:mysql://[host]:[port]/[database name]
Select 'Finish'.

Navigate to Connection Pools and select the pool you just created.
Click Ping to test that it is working. If it is not, it is probably because you have mistyped the connection credentials. Go to 'Additional Properties' tab of the connection pool detail page and correct any errors. Try ping again.

Open the 'Resources' -> 'JDBC' -> 'JDBC Resources' and select 'New.
Fill the JNDI Name like 'jdbc/myconnnection'.
Select from 'Pool Name' combo box the pool we just created.
And select 'OK'.

The Connection Pool is ready!


Saturday, March 15, 2014

Installing Dradis on Ubuntu

This is my way to install dradis-framework
The bold red is additional from other website.
Combination manual from http://guides.dradisframework.org/install_on_ubuntu.html

1 Running on Ubuntu

We are going to assume that either Ubuntu is your base OS or you are preparing an Ubuntu-base virtual machine.
If the latter going for 10 GB of disk and 2 GB of RAM should do the trick. You can download Ubuntu from:
A tutorial on how to install the base OS falls out of the scope of this guide, we will leave you a few minutes to get your new OS up and running.

2 Prerequisites: curl and git

Before we begin, there are a couple of packages that we will need:
etd@host:~$ sudo apt-get install curl git

Ubuntu / Debian 

http://nokogiri.org/tutorials/installing_nokogiri.html

Ubuntu doesn’t come with the Ruby development packages that are required for building gems with C extensions. Here are the commands to install everything you might need:
# ruby developer packages
sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8
sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby

# nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri

3 Installing Ruby 1.9.3

We are going to install Ruby 1.9.3 using RVM. This has the benefit of keeping everything under your `~/.rvm/` folder:
etd@host:~$ source ~/.profile
etd@host:~$ rvm -v
Once RVM is up and running we need to get a couple of libraries that will be required by the Ruby installation:
etd@host:~$ for package in zlib openssl libxslt libxml2; do rvm pkg install $package; done
And finally the Ruby 1.9.3 runtime:
etd@host:~$ rvm install 1.9.3
etd@host:~$ rvm 1.9.3 --default
etd@host:~$ ruby -v
There is an additional step that it’s not required but that will shorten the time required to install ruby gems:
etd@host:~$ echo "gem: --no-rdoc --no-ri" > ~/.gemrc
This tells RubyGems to not generate documentation for every library it installs.
Finally, we just need to install the Bundler gem, all other Ruby gems will be installed using Bundler:
etd@host:~$ gem install bundler
etd@host:~$ bundle -v

4 Download Dradis

We are going to work with the Git version of Dradis which is stable but contains the latest and greatest features:
etd@host:~$ mkdir dradis-git
etd@host:~$ cd dradis-git/
etd@host:~/dradis-git$ git clone https://github.com/dradis/dradisframework.git server
etd@host:~/dradis-git$ for file in verify reset start; do curl -O https://raw.github.com/dradis/meta/master/$file.sh; done
etd@host:~/dradis-git$ chmod +x *.sh
To make sure it everything is as it should, double check the contents of the directory:
etd@host:~/dradis-git$ ls -l
total 32
-rwxr-xr-x   1 etd  staff   847 Feb 19 14:26 reset.sh*
drwxr-xr-x  26 etd  staff   884 Feb 19 14:02 server/
-rwxr-xr-x   1 etd  staff   407 Feb 19 14:26 start.sh*
-rwxr-xr-x   1 etd  staff  6775 Feb 19 14:26 verify.sh*
We are going to create a gemset to store all the Ruby gems that Dradis requires in a self-contained package. This means that the libraries won’t affect any other apps you have installed. Also if you decide to remove Dradis, you can delete this gemset and cleanup the system.
To activate the gemset just enter the `server/` directory and answer yes when RVM asks:
etd@host:~/dradis-git$ cd server/
Do you wish to trust this .rvmrc file? (/home/etd/dradis-git/server/.rvmrc)
y[es], n[o], v[iew], c[ancel]> y
Using /home/etd/.rvm/gems/ruby-1.9.3-p125 with gemset dradis
etd@host:~/dradis-git/server$ cd ..
Once you have your copy of the repo, we need to install a few Ruby dependencies:

5 Preparing Dradis

Before you can start the server you need to run ./reset.sh this will prepare the config files for first use and will re-generate the repository database.
etd@host:~/dradis-git$ ./reset.sh
Some Ruby gems are missing, do you want to install them now? [y] y
This will install the libraries that are required to run Dradis. Once that’s is done, we need to run the script again:
etd@host:~/dradis-git$ ./reset.sh
The config file [config/database.yml.template] was found not to be ready to use.
Do you want to initialize it? [y]es | [N]o | initialize [a]ll
a
If you ever want to clear your repository (e.g. a new project begins), re-runing the command above will do the trick.
The final step is to make sure all the assets (i.e. images, JavaScripts, CSS, etc.) that Dradis needs are precompiled to ensure they load at maximum speed:
etd@host:~/dradis-git$ cd server/
etd@host:~/dradis-git/server$ RAILS_ENV=production bundle exec rake assets:precompile
etd@host:~/dradis-git/server$ cd ../

6 Running Dradis

Once everything is ready, you can run the server with:
etd@host:~/dradis-git$ ./start.sh
You are ready to browse: https://127.0.0.1:3004/
The script also accepts the -h flag to help you with additional arguments to customize the binding address and port number.
For instance to bind to port 443 and listen in all interfaces you can run:
etd@host:~/dradis-git$ ./start.sh -b 0.0.0.0 -p 443