centos7.0 の変更点   

  • 追加された行はこの色です。
  • 削除された行はこの色です。
  • centos7.0 へ行く。

#author("2020-06-01T05:53:30+00:00","default:pentacle","pentacle")
+ OSのインストールイメージダウンロード
 http://ftp.jaist.ac.jp/pub/Linux/CentOS/7/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso

[[VMWare]] で minimal install

+ 新規仮想マシンの作成
-- 後でOSを位ストール
+ Linux / CentOS 64 ビット
+ 仮想ディスクを単一ファイルとして格納
+ ハードウェアをカスタマイズ
-- 新規 CD/DVD(IDE) - ISOイメージファイルを使用する
-- ネットワークアダプタ - ブリッジ
+ 仮想マシンの再生
+ Install CentOS 7
++ 言語を選択:日本語
++ network のチェックボックスをONに設定:「完了」
++ インストール先:そのまま「完了」
++ パーティション設定をそのまま左上の「完了」
++ インストールの開始
+ root のパスワード:脆弱なままだと「完了」を2回

* ネットワーク初期設定 [#k8795bde]
 ip a
IP が取れていない場合は
 nmtui 
で、auto connect にチェックをいれ、OK

DHCPが使えない場合
|IP     |192.168.80.100/24|
|Gateway|192.168.80.2     |
|DNS    |192.168.80.2     |

* 基本コマンド変更点 [#ab9c627d]
- ifconfig 
 ip a
- netstat
 ss 

----
* 初期更新 [#x30c5d63]
 yum -y update
 yum -y install emacs nmap lrzsz yum-utils zip unzip wget ntp bind-utils telnet curl bash-completion net-tools samba-client samba-winbind cifs-utils

 cat > ~/.emacs

 (setq make-backup-files nil)
 (setq auto-save-default nil)
 
 

 package-cleanup --oldkernels --count=1

 cat >> /etc/cron.hourly/ntpdate

 /usr/sbin/ntpdate ntp.nict.jp
 

 chmod +x /etc/cron.hourly/ntpdate
 /etc/cron.hourly/ntpdate

 timedatectl set-timezone Asia/Tokyo
 localectl set-keymap jp
 localectl set-locale LANG=ja_JP.utf8

''/etc/ssh/sshd_config''
 Protocol 2
 PasswordAuthentication no
 PermitRootLogin no
 RSAAuthentication yes
 PubkeyAuthentication yes
 RhostsRSAAuthentication no

 service sshd restart

ssh でログイン

** hostname [#i7e21cc0]
 hostnamectl set-hostname server1.example.com

*** aws の場合 [#o5e3e6ae]
''/etc/cloud/cloud.cfg''
  # - update_hostname

** selinux/firewall 無効化したい場合 [#hfd8cd76]
 systemctl disable firewalld

''/etc/selinux/config''
 SELINUX=disabled

 reboot

*** apache [#ufa87c97]
 yum -y install httpd mod_ssl
 systemctl enable httpd
 iptables -I INPUT 5 -p tcp -m tcp --dport 80 -j ACCEPT
 iptables -I INPUT 5 -p tcp -m tcp --dport 443 -j ACCEPT
 firewall-cmd --add-service=http --zone=public --permanent
 firewall-cmd --add-service=https --zone=public --permanent
 service httpd restart

その他のポートを開けたい場合~
[[firewalld]]

''reverse-proxy などをする場合''
 /usr/sbin/setsebool -P httpd_can_network_connect 1

*** ntpd [#pd380778]
''/etc/ntp.conf''
 server 0.centos.pool.ntp.org iburst

 service ntpd start
 ntpq -p

 systemctl enable ntpd.service

*** mariadb [#gdf74c9a]
 yum -y install mariadb mariadb-server
 systemctl enable mariadb.service
 systemctl start mariadb.service
 
''/etc/my.cnf''
 [[mysqld]]
 character-set-server=utf8
 [mysql]
 character-set-server=utf8

*** php [#y7c5f467]
 yum -y install php php-pear
 pear upgrade PEAR
 

*** ImageMagick [#ff7fde58]
 yum -y install ImageMagick ImageMagick-perl ImageMagick-devel ipa-pgothic-fonts

*** httpd 再起動 [#m1952159]
 systemctl start httpd 

*** java [#j059f310]

 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
 rpm -ivh jdk-8u66-linux-x64.rpm 

 旧 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.rpm

最新を探す
 http://www.oracle.com/technetwork/java/javase/downloads/index.html
----

上記状態で保存したテンプレートイメージをコピーして再度VMWare で起動した場合、最初に「移動」か「コピー」かを問われる。~
同時に2台起動する可能性がある場合は「コピー」を選択する。~


---- 
* epel [#q32a9f0e]
 yum -y install epel-release

''/etc/yum.repos.d/epel.repo''
 enabled = 0

*** nkf [#rf10d32d]
 yum -y --enablerepo=epel install nkf

*** jq [#rf10d32d]
 yum -y --enablerepo=epel install jq

*** postgres + postgis [#x3603427]
 yum -y --enablerepo=epel install postgis postgresql-server
 postgresql-setup initdb
 systemctl enable postgresql.service
 systemctl start postgresql.service

最新を入れたい場合
 rpm -Uvh https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
 yum -y install epel-release centos-release-scl
 yum -y install --enablerepo=epel postgresql12-server postgresql12-devel postgresql21-contrib gdal postgis30_12.x86_64 postgis30_12-client.x86_64 postgis30_12-devel.x96_64
 /usr/pgsql-12/bin/postgresql-12-setup initdb

''/var/lib/pgsql/*/data/pg_hba.conf''
 local   all             all                                     trust

 service postgresql-11 restart

 psql -U postgres -c "alter role postgres with password '【パスワード】';"

''/var/lib/pgsql/*/data/pg_hba.conf''
 local   all             all                                     password
 host    all             all                                     password

 systemctl enable postgresql-11
 service postgresql-11 restart

*git [#j495ce6d]
  yum -y install git --enablerepo=epel

※結構古いので新しいのを入れたい場合はソースからいれる

* NTFS マウント [#g318f5e1]
 yum -y --enablerepo=epel install dkms fuse-ntfs-3g

''/etc/fstab''
 /dev/sdb2 /mnt/usbhdd ntfs-3g defaults 0 0

* ディスクを追加したい [#c10b9815]
 fdisk /dev/sdb

 n
 p
 w

*** format [#e22f741d]
 mkfs -t xfs /dev/sdb1

*** mount [#w20642d9]
 blkid /dev/sdb1

''/etc/fstab''
 UUID=7ae7276e-45a4-4780-b096-4e3b4cxxxxxx /mnt/ssd                    xfs     defaults        0 0

* samba [#d09376f6]
 yum install samba




* sshfs [#t6f3700c]
 yum install sshfs --enablerepo=epel
 sshfs 192.168.0.1:/mnt/usbhdd /mnt/usbhdd

* devtools [#zfb12df6]
 yum -y groupinstall 開発ツール

* nodejs [#t2651a5f]
 git clone https://github.com/creationix/nvm.git ~/.nvm
 source ~/.nvm/nvm.sh
 nvm install 0

''.bashrc''
 source ~/.nvm/nvm.sh


* redis [#f5cd2042]
  yum -y install redis --enablerepo=epel

 service redis start

 redis-cli

 > set 'test' 10
 OK
 > get 'test'
 "10"
 > exit

* ruby [#cc991cb9]
 cd /usr/local/src
 wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
 tar xzfp ruby-2.2.2.tar.gz
 cd ruby*
 ./configure --disable-install-doc
 make
 make install

* convmvfs [#b82ad71c]
EUCの HDD を UTF でマウントしたい場合などに使用
 cd /usr/src
 wget https://github.com/libfuse/libfuse/releases/download/fuse-2.9.7/fuse-2.9.7.tar.gz
 tar xzfp fuse-*
 cd fuse-*
 ./configure --prefix=/usr
 make 
 make install
 ldconfig
 cd /usr/src
 wget "http://osdn.jp/frs/g_redir.php?m=kent&f=%2Ffuse-convmvfs%2Ffuse-convmvfs%2F0.2.6%2Ffuse-convmvfs-0.2.6.tar.gz" -O fuse-convmvfs-0.2.6.tar.gz
 tar xzfp fuse-conv*
 cd fuse-conv*
 export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/
 make 
 make install