Category Archives: Linux

CentOS7でTomcatのポート8080を開放する

操作コマンド
firewall-cmd –zone=public –add-port=8080/tcp –permanent
firewall-cmd –reload

firewalldを起動
systemctl start firewalld
systemctl enable firewalld

CentOS7でdocker1.9.1をインストールする

1.Dockerのインストール
#yum -y install Docker-io
Dockerバージョンの確認
#docker -v
Docker version 1.9.1, build ab77bde/1.9.1

2.Docker起動
systemctl start docker.service #起動
systemctl stop docker.service #停止
systemctl status docker.service #状態

3.ミラーの確認
docker images
docker search centos
4.Dockerコンテナを作成
docker run -i -t xxx /bin/bash

5.指定されたコンテナを起動
docker start xxxx

CentOS7でDocker Engineをインストールする

1.OSバージョンの確認
$ uname -r
3.10.0-229.el7.x86_64

2.yumでDocker Engineをインストール
$ sudo yum update
$ sudo tee /etc/yum.repos.d/docker.repo <<-‘EOF’
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
3.Dockerパッケージをインストール
$ sudo yum install docker-engine
4.Dockerサービス自動起動
$ sudo systemctl enable docker.service

5.Docker起動
$ sudo systemctl start docker
6.Dockerをチェック
$ sudo docker run –rm hello-world

Docker Engineをインストール
$ sudo yum update
$ curl -fsSL https://get.docker.com/ | sh
$ sudo systemctl enable docker.service
$ sudo systemctl start docker
$ sudo docker run –rm hello-world

Linux入門– touchコマンドでファイル作成、タイムスタンプ更新操作

例1:ファイルを作成
# touch 2015ctn.log 2016ctn.log
# ll
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2015ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2016ctn.log

# touch -c log2014.log
# ll
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2015ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2016ctn.log

例2:タイムスタンプを更新
#touch -r log.log 2015ctn.log
# ll
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2015ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2016ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 14:48 log.log
# touch -r log.log 2015ctn.log
# ll
-rw-r–r– 1 appuser appuser 0 10-28 14:48 2015ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2016ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 14:48 log.log

例3:ファイルのタイムスタンプを設定
#touch -t 201611142234.50 log.log
# ll
-rw-r–r– 1 appuser appuser 0 10-28 14:48 2015ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2016ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 14:48 log.log
# touch -t 201611142234.50 log.log
# ll
-rw-r–r– 1 appuser appuser 0 10-28 14:48 2015ctn.log
-rw-r–r– 1 appuser appuser 0 10-28 16:01 2016ctn.log
-rw-r–r– 1 appuser appuser 0 2016-11-14 log.log

Linux入門–pwdコマンドの使い方

1.現在のディレクトリの場所を確認
# pwd
/opt/jmeter/data

2.リンクのパスを確認
# cd /etc/init.d
[root@localhost init.d]# pwd
/etc/init.d
[root@localhost init.d]# pwd -P
/etc/rc.d/init.d

3.pwdコマンドサンプル
root@localhost init.d]# cd /opt/soft
[root@localhost soft]# mkdir removed
[root@localhost soft]# cd removed/
[root@localhost removed]# pwd
/opt/soft/removed
[root@localhost removed]# rm ../removed -rf
[root@localhost removed]# pwd
/opt/soft/removed
[root@localhost removed]# /bin/pwd
/bin/pwd: couldn’t find directory entry in “..” with matching i-node
[root@localhost removed]# cd
[root@localhost ~]# pwd
/root
[root@localhost ~]#

CentOS6.7でlibc.so.6(GLIBC_2.11) is needed by MarkLogic-8.0-6.x86_64対策

1.エラー情報
# rpm -ivh MarkLogic-RHEL6-8.0-6.x86_64.rpm
error: Failed dependencies:
libc.so.6(GLIBC_2.11) is needed by MarkLogic-8.0-6.x86_64
2.libc.so.6の検索
#yum provides libc.so.6
glibc-2.12-1.192.el6.i686
#rpm -qa | grep gdb
gdbm-devel-1.8.0-39.el6.x86_64

3.インストールされたglibcを確認
# rpm -qa | grep glibc
glibc-devel-2.12-1.192.el6.x86_64
glibc-common-2.12-1.192.el6.x86_64
glibc-headers-2.12-1.192.el6.x86_64
glibc-2.12-1.192.el6.x86_64
# rpm -qa | grep libgcc
libgcc-4.4.7-16.el6.x86_64
# rpm -qa | grep nss-softokn-freebl
nss-softokn-freebl-3.14.3-23.el6_7.x86_64
# ls -al glibc-2.12*

4.依存関係パッケージをインストールする
#rpm -ivh libgcc-4.4.7-16.el6.i686.rpm glibc-2.12-1.192.el6.i686.rpm nss-softokn-freebl-3.14.3-23.el6_7.i686.rpm
warning: libgcc-4.4.7-16.el6.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing… ########################################### [100%]
1:libgcc ########################################### [ 33%]
2:nss-softokn-freebl ########################################### [ 67%]
3:glibc ###########################################
# rpm -ivh MarkLogic-RHEL6-8.0-6.x86_64.rpm
Preparing… ########################################### [100%]
1:MarkLogic ###########################################

Linuxでmemcachedのインストール

1.memcachedのインストール
# wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
# wget http://www.monkey.org/~provos/libevent-2.0.10-stable.tar.gz
# tar zxf libevent-2.0.10-stable.tar.gz
# cd libevent-2.0.10-stable
# ./configure –prefix=/usr
# make
# make install
# cd ../
# tar zxf memcached-1.4.5.tar.gz
# cd memcached-1.4.5
# ./configure –prefix=/usr/local/memcached –with-libevent=/usr
# make
# make install
# /usr/local/memcached/bin/memcached -d -m 10 -l 172.17.200.109 -p 11211 -u root -c 256 -P /usr/local/memcached/memcached.pid
2.memcacheを追加
# tar zxf memcache-2.2.6.tgz
# cd memcache-2.2.6
# /usr/local/php/bin/phpize
# ./configure –with-php-config=/usr/local/php/bin/php-config
# make
# make install
# ll
/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/memcache.so
php.iniの修正
前 extension_dir = “./”
後 extension_dir = “/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/”
追加
extension=memcache.so
サーバが再起動

3.memcacheの検証
# pwd
/usr/local/nginx/html
# vi mem.php
<?php
$mem = new Memcache;
$mem->connect(“172.17.200.109”, 11211);
$mem->set(‘key’,’this is a test page!’, 0, 60);
$val = $mem->get(‘key’);
echo $val;
?>

Linuxでtelenetのインストールとmemcachedの状態を調べる方法

1.telenetをインストール
#yum install telnet-server
#yum install telnet
#vi /etc/xinetd.d/telnet

service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = yes
}

xinetd起動
#/etc/init.d/xinetd restart

memcached起動
#/usr/local/memcached/bin/memcached -d -c 10240 -m 1024 -u root

2.状態の確認
#echo stats | nc localhost 10210
#ps -ef|grep memcached

memcached停止
#kill -9 pid

# telnet 127.0.0.1 10210
Trying 127.0.0.1…
Connected to 127.0.0.1.
Escape character is ‘^]’.
stats

3.操作コマンド
STAT pid 12362
STAT uptime 1469315
STAT time 1339671194
STAT version 1.4.9
STAT libevent 1.4.9-stable
STAT pointer_size 64
STAT rusage_user 3695.485200
STAT rusage_system 14751.273465
STAT curr_connections 69
STAT total_connections 855430
STAT connection_structures 74
STAT reserved_fds 20
STAT cmd_get 328806688
STAT cmd_set 75441133
STAT cmd_flush 34
STAT cmd_touch 0
STAT get_hits 253547177
STAT get_misses 75259511
STAT delete_misses 4
STAT delete_hits 565730
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 545701515844
STAT bytes_written 1649639749866
STAT limit_maxbytes 2147483648
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 14
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT expired_unfetched 30705763
STAT evicted_unfetched 0
STAT bytes 61380700
STAT curr_items 28786
STAT total_items 75441133
STAT evictions 0
STAT reclaimed 39957976
END

Ubuntu でSubversionのインストールと設定方法メモ

1.インストール apache2 libapache2-svn subversion
#sudo apt-get install apache2
#sudo apt-get install subversion
#sudo apt-get install libapache2-svn

#/etc/init.d/apache2 restart

2.SVNプロジェクトを作成
#sudo mkdir /home/svn
#sudo svnadmin create /home/svn/project

3.グループの追加
#sudo addgroup subversion
#sudo usermod -G subversion -a www-data
#more /etc/group | grep subversion
subversion:x:1001:www-data

4.プロジェクトの権限を設定
#sudo chown -R root:subversion /home/svn/project
#sudo chmod -R g+rws /home/svn/project
#ls -l /home/svn/myproject/db/txn-current-lock

5.コマンドでライブラリにアクセス
#sudo svn co file://localhost/home/svn/project
#sudo svn co file:///home/svn/project

6.apache2を設定
#vim /etc/apache2/mods-available/dav_svn.conf
#sudo vim /etc/apache2/mods-available/dav_svn.conf
コードの追加:
<Location /svn/project>
DAV svn
SVNPath /home/svn/myproject
AuthType Basic
AuthName “project subversion repository”
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>

apache再起動

7.#vim /etc/subversion/passwd
#sudo htpasswd -c /etc/subversion/passwd [user_name]
#svn co http://hostname/svn/project project –username [username]

Ubuntu 15.04でrootユーザを有効する

$ sudo passwd root
Enter new UNIX password:xxxx
Retype new UNIX password: xxx
passwd: password updated successfully