Tagged: ubuntu

Adding a System User in Ubuntu


http://askubuntu.com/a/567852/91209

$ adduser --system --no-create-home --group USERNAME
Advertisements

java_home environment variable


Windows

N/A

OS X

installations

$ ls -l /Library/Java/JavaVirtualMachines/
....
$

/usr/libexec/java_home

$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdkx.y.z_mm.jdk/Contents/Home

$ /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0_mm.jdk/Contents/Home

$ /usr/libexec/java_home -v 1.7
/Library/Java/JavaVirtualMachines/jdk1.7.0_mm.jdk/Contents/Home

~/.profile

$ cat ~/.profile
...
export JAVA7_HOME=$(/usr/libexec/java_home -v 1.7)
export JAVA8_HOME=$(/usr/libexec/java_home -v 1.8)
export JAVA_HOME=$JAVA8_HOME
...

$ echo $JAVA7_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home

$ echo $JAVA8_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home

$

Ubuntu

See installing latest oracle jdk in old ubuntu.

Xubuntu 창 크기 조절하기


Xubuntu에서 창 크기 줄이고 늘리는 게 영 불편했다. 보통 오른쪽 아랫부분에 마우스를 가져가면 할 수 있을 거라고 생각했지만 위/아래 혹은 왼/오른쪽이 아닌 대각으로 잡히는 부분이 너무 작았다. 뭔가 설정파일을 수정하면 될 듯 해서 찾던 중 그냥 Alt 키를 누르고 마우스 오른쪽 버튼으로 대충 잡아끌면 되는 듯 하다.

Ask Ubuntu.

Changing Ubuntu Server Apt Source Repository


References

Abstract

Ubuntu Server, unlike the Ubuntu Desktop, has no GUI environment with fresh installation.

Backup

$ pwd
/etc/apt
$ ls -l
...
sources.list
...
$ sudo cp sources.list sources.list.bak
$ ls -l
...
source.list
source.list.bak
...
$ 

Check

Let’s take a look at the file.

$ pwd
/etc/apt
$ cat source.list
...
deb-src http://slower.ubuntu.com/ubuntu/ trusty multiverse
...
$

Update

Change all slower.ubuntu.com to faster.ubuntu.com.

$ pwd
/etc/apt
$ sudo vi source.list
$ cat source.list
...
deb-src http://faster.ubuntu.com/ubuntu/ trusty multiverse
...
$ 

Note

Those domain addresses used in above example aren’t real. In my case I changed kr.archive.ubuntu.com to ftp.daum.net.

Installing VirtualBox Guest Additions in Ubuntu Server


Insert the image by selecting the menu item of Devices / Insert Guest Additions CD Image... (Host+D).

Mount the inserted image.

$ sudo mount -t iso9660 -o ro /dev/cdrom /media/cdrom

Execute VBoxLinuxAdditions.run file.

$ cd /media/cdrom
$ ls -1F
...
VBoxLinuxAdditions.run
...
$ sudo ./VBoxLinuxAdditions.run
...
$

The script may complain about the absence of gcc and make. Install them and run the script again.

$ sudo apt-get -y install gcc make
...
$ sudo ./VBoxLinuxAdditions.sh
...
$

You can unmount the cdrom.

$ sudo umount /media/cdrom
$

You might want to reboot the guest.

$ sudo /sbin/shutdown -r now
$

One of benefits that guest additions offers is sharing folders between the host and the guest.

$ ls -l /media
drwxr-xr-x 2 root root    ____ MMM dd HH:mm cdrom/
drwxrwx--- 1 root vboxsf _____ MMM dd HH:mm sf_shared/
$

You can add yourself to vboxsf group and use them.

$ sudo adduser <yourself> vboxsf
...

You need to logout and login for making the change effects.

$ logout
$

Now you can read/(write) in the shared directory.

$ cd /media/sf_shared/
$ echo test > test.txt
$ cat test.txt
test
$

Installing Apache Maven in Ubuntu


Installing the latest binary

Copy the link of the latest binary at here.

$ cd /opt
$ sudo wget http://.../.../.../apache-maven-x.y.z-bin.tar.gz
$ ls -1F
apache-maven-x.y.z-bin.tar.gz
$ sudo tar -xzf apache-maven-x.y.z-bin.tar.gz
$ ls -1F
apache-maven-x.y.z/
apache-maven-x.y.z-bin.tar.gz
$ sudo ln -s apache-maven-x.y.z apache-maven-latest
$ ls -1F
apache-maven-x.y.z
apache-maven-x.y.z-bin.tar.gz
apache-mavenlatest@
$

Edit /etc/environment and append :/opt/apache-maven-latest/bin to PATH. Note that : character is a path separator.

$ cat /etc/environment
PATH="/../..:/opt/apache-maven-latest/bin"
$ source /etc/environment
$ which mvn
/opt/apache-maven-latest/bin/mvn
$ mvn --version
Apache Maven x.y.z ...
Maven home: /opt/apache-maven-latest
...

Upgrading to a newer version

When you need to upgrade to a newer version. Just extract the newer binary and change the symbolic link’s target with the -f option.

$ cd /opt
$ sudo wget http://.../.../.../apache-maven-9.9.9-bin.tar.gz
$ ls -1F
apache-maven-9.9.9-bin.tar.gz
$ sudo tar -xzf apache-maven-9.9.9-bin.tar.gz
$ ls -1F
apache-maven-9.9.9/
apache-maven-9.9.9.-bin.tar.gz
$ sudo ln -sf apache-maven-9.9.9 apache-maven-latest
$