passwd
adduser qubo
usermod -a -G sudo qubo
visudo
%sudo ALL=(ALL) ALL
apt-get update
apt-get upgrade
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -j DROP
iptables -I INPUT 1 -i lo -j ACCEPT
iptables-save > /etc/iptables.rules
set your rules to apply at boot
nano /etc/network/if-pre-up.d/iptaload
#!/bin/sh
iptables-restore < /etc/if-post-up.d/iptasave
create a file to save rules
nano /etc/network/if-post-down.d/iptasave
#!/bin/sh
iptables-save -c > /etc/iptables.save
if [ -f /etc/iptables.dowrules ]; then
iptables-restore < /etc/iptables.downrules
fi
exit 0
make those files executable
chmod +x /etc/network/if-post-down.d/iptasave
chmod +x /etc/network/if-pre-up.d/iptaload
Installing MySQL Server on Ubuntu
sudo aptitude update
sudo aptitude install mysql-server
iptables -I INPUT -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT
sudo service mysql start
Append these settings for each section
[client]
default-character-set = utf8
[mysqld]
default-character-set = utf8
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8
[mysql]
default-character-set = utf8
sudo /etc/init.d/mysql restart
sudo /usr/sbin/update-rc.d mysql defaults
/usr/bin/mysql -u root -p
Setting the root password
UPDATE mysql.user SET Password = PASSWORD('password') WHERE User = 'root';
INSERT INTO mysql.user (Host,User,Password) VALUES('localhost','demouser',PASSWORD('demopassword'));
SET PASSWORD FOR 'username'@'localhost' = PASSWORD('password');
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON databasename.* TO username@localhost;
FLUSH PRIVILEGES;
Install add-apt-repository
sudo aptitude install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-jdk7-installer
Download Apache Tomcat 7.0.26
wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/tomcat/tomcat-7/v7.0.26/bin/apache-tomcat-7.0.26.tar.gz
tar -xzf apache-tomcat-7.0.26.tar.gz
move extracted folder
sudo mv apache-tomcat-7.0.26 /opt/tomcat7
sudo useradd -d /opt/tomcat7 -s /bin/false tomcat
change owner to tomcat user
chown -R tomcat. /opt/tomcat7
iptables -I INPUT 6 -p tcp --dport 8080 -j ACCEPT
sudo /opt/tomcat7/bin/startup.sh
sudo /opt/tomcat7/bin/shutdown.sh
sudo apt-get install zsh
chsh -s /usr/bin/zsh
vim .zshrc
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -e
#
setopt auto_cd
setopt auto_pushd
setopt correct
setopt list_packed
setopt nolistbeep
#
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z} r:|[-_.]=**'
#
autoload -Uz compinit
compinit
#
#
export LANG=ja_JP.UTF-8
export JLESSCHARSET=japanese-UTF-8
export OUTPUT_CHARSET=UTF-8
#
# 31: red
# 32: green
# 33: yellow
# 34: blue
# 35: purple
# 36; azure
#
case ${UID} in
0)
PROMPT=$'%{\e[31m%}%n%# %{\e[m%}'
;;
*)
PROMPT=$'%{\e[37m%}%n%# %{\e[m%}'
;;
esac
#
PROMPT2=$'%{\e[33m%}%n%# > %{\e[m%}'
RPROMPT=$'%{\e[32m%}[%~]%{\e[m%}'
SPROMPT="correct: %R -> %r ? "
#
alias la='ls -lA --color'
alias l='ls --color'
alias a='ls -lA --color'
sudo locale-gen ja_JP.UTF-8
sudo /usr/sbin/update-locale LANG=ja_JP.UTF-8
Install uim-fep and uim-anthy
sudo apt-get install uim-fep
sudo apt-get install uim-anthy
Set shortcut-key to enable uim-fep
vim ~/.uim
(define default-im-name 'anthy)
(define-key generic-on-key? '("<Control> "))
(define-key generic-off-key? '("<Control> "))
uim-fep