Saturday, 30 September 2017

[Hadoop] Install Hadoop as Standalone in CentOS 7

1. Install RSync

#> yum -y install rsync




2. Download Hadoop

http://hadoop.apache.org/releases.html

#> cd /usr/local
#> wget http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.8.1/hadoop-2.8.1.tar.gz



3. Unzip Hadoop file

#> tar zxf hadoop-2.8.1.tar.gz




4. Setup environment variables

#> cd /usr/local/hadoop-2.8.1/etc/hadoop
#> vi hadoop-env.sh
#> vi ~/.bash_profile








5. Configure core-site.xml file

#> cd /usr/local/hadoop-2.8.1/etc/hadoop
#> vi core-site.xml




6. Configure hdfs-site.xml

#> cd /usr/local/hadoop-2.8.1/etc/hadoop
#> vi hdfs-site.xml







7. Create SSH key

#> ssh-keygen -t rsa
#> cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys





8. Test SSH

#> ssh localhost




9. Format NameNode

#> hadoop namenode -format






10. Startup Hadoop

#> start-all.sh





11. Connect on Web browser

http://hadoophost:50070

[CentOS] Setup FTP when SElinux is enabled

1. Set FTP User home directory (FTP 유저 홈디렉터리 설정)

#> chown -R ftp:ftp /var/ftp
#> semanage fcontext -a -t public_content_rw_t /var/ftp
#> restorecon -Rvv /var/ftp
#> setsebool -P ftp_home_dir 1
#> setsebool -P ftpd_full_access 1
#> ls -lZ /var | grep ftp




2. Restart FTP service

# Set FTP service auto enable
#> systemctl enable vsftpd

# Restart FTP Server
#> systemctl restart vsftpd

[CentOS] Set enable to connect FTP server by root user

1. Edit /etc/vsftpd/user_list and exclude root user


#> vi /etc/vsftpd/user_list




2. Edit /etc/vsftpd/ftpusers and exclude root user

#> /etc/vsftpd/ftpusers

Friday, 22 September 2017

[Java] How to get OS name, version, CPU Architecture from System.property(String)

System.getProperty("os.name");
System.getProperty("os.version");
System.getProperty("os.arch");

os.name os.version os.arch Comments
Linux 2.0.31 x86 IBM Java 1.3
Linux (*) i386 Sun Java 1.3.1, 1.4 or Blackdown Java; (*) os.version depends on Linux Kernel version
Linux (*) x86_64 Blackdown Java; note x86_64 might change to amd64; (*) os.version depends on Linux Kernel version
Linux (*) sparc Blackdown Java; (*) os.version depends on Linux Kernel version
Linux (*) ppc Blackdown Java; (*) os.version depends on Linux Kernel version
Linux (*) armv41 Blackdown Java; (*) os.version depends on Linux Kernel version
Linux (*) i686 GNU Java Compiler (GCJ); (*) os.version depends on Linux Kernel version
Linux (*) ppc64 IBM Java 1.3; (*) os.version depends on Linux Kernel version
Mac OS 7.5.1 PowerPC
Mac OS 8.1 PowerPC
Mac OS 9.0, 9.2.2 PowerPC MacOS 9.0: java.version=1.1.8, mrj.version=2.2.5; MacOS 9.2.2: java.version=1.1.8 mrj.version=2.2.5
Mac OS X 10.1.3 ppc
Mac OS X 10.2.6 ppc Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-39)
Java HotSpot(TM) Client VM (build 1.4.1_01-14, mixed mode)
Mac OS X 10.2.8 ppc using 1.3 JVM: java.vm.version=1.3.1_03-74, mrj.version=3.3.2; using 1.4 JVM: java.vm.version=1.4.1_01-24, mrj.version=69.1
Mac OS X 10.3.1, 10.3.2, 10.3.3, 10.3.4ppc JDK 1.4.x
Mac OS X 10.3.8 ppc Mac OS X 10.3.8 Server; using 1.3 JVM: java.vm.version=1.3.1_03-76, mrj.version=3.3.3; using 1.4 JVM: java.vm.version=1.4.2-38; mrj.version=141.3
Windows 95 4.0 x86
Windows 98 4.10 x86 Note, that if you run Sun JDK 1.2.1 or 1.2.2 Windows 98 identifies itself as Windows 95.
Windows Me 4.90 x86
Windows NT 4.0 x86
Windows 20005.0 x86
Windows XP 5.1 x86 Note, that if you run older Java runtimes Windows XP identifies itself as Windows 2000.
Windows 20035.2 x86 java.vm.version=1.4.2_06-b03; Note, that Windows Server 2003 identifies itself only as Windows 2003.
Windows CE 3.0 build 11171 arm Compaq iPAQ 3950 (PocketPC 2002)
OS/2 20.40 x86
Solaris 2.x sparc
SunOS 5.7 sparc Sun Ultra 5 running Solaris 2.7
SunOS 5.8 sparc Sun Ultra 2 running Solaris 8
SunOS 5.9 sparc Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
MPE/iX C.55.00 PA-RISC
HP-UX B.10.20 PA-RISC JDK 1.1.x
HP-UX B.11.00 PA-RISC JDK 1.1.x
HP-UX B.11.11 PA-RISC JDK 1.1.x
HP-UX B.11.11 PA_RISC JDK 1.2.x/1.3.x; note Java 2 returns PA_RISC and Java 1 returns PA-RISC
HP-UX B.11.00 PA_RISC JDK 1.2.x/1.3.x
HP-UX B.11.23 IA64N JDK 1.4.x
HP-UX B.11.11 PA_RISC2.0JDK 1.3.x or JDK 1.4.x, when run on a PA-RISC 2.0 system
HP-UX B.11.11 PA_RISC JDK 1.2.x, even when run on a PA-RISC 2.0 system
HP-UX B.11.11 PA-RISC JDK 1.1.x, even when run on a PA-RISC 2.0 system
AIX 5.2 ppc64 sun.arch.data.model=64
AIX 4.3 Power
AIX 4.1 POWER_RS
OS/390 390 02.10.00 J2RE 1.3.1 IBM OS/390 Persistent Reusable VM
FreeBSD 2.2.2-RELEASE x86
Irix 6.3 mips
Digital Unix4.0 alpha
NetWare 4.114.11 x86
OSF1 V5.1 alpha Java 1.3.1 on Compaq (now HP) Tru64 Unix V5.1
OpenVMS V7.2-1 alpha Java 1.3.1_1 on OpenVMS 7.2


Reference : http://lopica.sourceforge.net/os.html