-------------------------------------------------------------------------------- 備考: ・Windows10上にVirtualBoxでLinux環境を構築します。 ・インターネットにつながっていない環境にも対応しています。 -------------------------------------------------------------------------------- ・前処理 ・用意するもの CentOS-7-x86_64-DVD-1810.iso apache-tomcat-9.0.19.tar.gz eclipse-jee-2019-03-R-linux-gtk-x86_64.tar.gz git-2.9.5.tar.xz git-htmldocs-2.9.5.tar.xz gnucobol-3.0-rc1.tar.xz jdk-12.0.1_linux-x64_bin.rpm nkf-2.1.5.tar.gz php-7.3.2.tar.gz spring-tool-suite-4-4.2.1.RELEASE-e4.11.0-linux.gtk.x86_64.tar.gz texlive2018-20180414.iso ・準備 ・マウント: CentOS-7-x86_64-DVD-1810.iso -------------------------------------------------------------------------------- ・Oracle VM VirtualBox マネージャ で 新規作成 ・名前 c7 ・タイプ Linux ・バージョン Other Linux (64bit) ・メモリサイズ 1024MB ・仮想ハードディスクを作成する ・ハードディスクのファイルタイプ: VDI(VirtualBox Disk Image) ・物理ハードディスクにあるストレージ: 可変サイズ ・ファイルの場所とサイズ: c7, 80GB ・[作成] -------------------------------------------------------------------------------- ・ネットワーク設定 ・[設定(S)] - ネットワーク ・割り当て(A): ブリッジアダプター ・[OK] -------------------------------------------------------------------------------- ・インストール ・起動(T) ・Install CentOS 7 ・Language: English (United States) ・DATE & TIME: Asia Tokyo ・KEYBOARD: Japanese ・SOFTWARE SELECTION: Server with GUI; Development Tools; ・KDUMP: disabled ・NETWORK & HOST ; Ethernet = ON; ・[Begin Installation] ・ROOT PASSWORD ・USER CREATION ・(処理終了を待つ) ・Reboot ・(再起動後に仮想ドライブをアンマウント) ・LICENSE INFORMATION: I accpt the license agreement. ・[FINISH CONFIGURATION] ・Log-in and Initial GUI settings... ・固定IP $ su - # cd /etc/sysconfig/network-scripts # cp ifcfg-enp0s3 _ifcfg-enp0s3_org # vi ifcfg-enp0s3 # diff _ifcfg-enp0s3_org ifcfg-enp0s3 < BOOTPROTO="dhcp" --- > BOOTPROTO="static" > IPADDR="192.168.3.223" > NETMASK="255.255.255.0" > GATEWAY="192.168.3.1" # ・Disable SELINUX # cd /etc/selinux # vi config # grep '^SELINUX=' config SELINUX=disabled # ・Not GUI # systemctl set-default multi-user.target # shutdown -r now ・DNS Client (外部接続しない場合は不要。) # vi /etc/resolv.conf # cat /etc/resolv.conf nameserver 192.168.3.1 # -------------------------------------------------------------------------------- ・以降、client端末からsshでログインし、処理します。 -------------------------------------------------------------------------------- ・パッケージの構築 ・クライアント側から、以下のファイルをサーバのどこか(例えば/...anywhere...)にコピー。 CentOS-7-x86_64-DVD-1810.iso apache-tomcat-9.0.19.tar.gz eclipse-jee-2019-03-R-linux-gtk-x86_64.tar.gz git-2.9.5.tar.xz git-htmldocs-2.9.5.tar.xz gnucobol-3.0-rc1.tar.xz jdk-12.0.1_linux-x64_bin.rpm nkf-2.1.5.tar.gz php-7.3.2.tar.gz spring-tool-suite-4-4.2.1.RELEASE-e4.11.0-linux.gtk.x86_64.tar.gz texlive2018-20180414.iso ・サーバ側はrootで処理。 # mount -o loop -t iso9660 /...anywhere.../CentOS-7-x86_64-DVD-1810.iso /mnt # mkdir /Packages # cd /Packages # cp /mnt/Packages/* . # umount /mnt # rm -f /...anywhere.../CentOS-7-x86_64-DVD-1708.iso -------------------------------------------------------------------------------- ・ソフトウェアのインストール ・ImageMagick # cd /Packages # rpm -ivh \ ImageMagick-6.7.8.9-15.el7_2.x86_64.rpm \ libwmf-lite-0.2.8.4-41.el7_1.x86_64.rpm \ ilmbase-1.0.3-7.el7.x86_64.rpm \ OpenEXR-libs-1.7.1-7.el7.x86_64.rpm ・emacs # cd /Packages # rpm -ivh \ emacs-24.3-22.el7.x86_64.rpm \ emacs-common-24.3-22.el7.x86_64.rpm \ libotf-0.9.13-4.el7.x86_64.rpm \ libXaw-1.0.13-4.el7.x86_64.rpm \ liblockfile-1.08-17.el7.x86_64.rpm ・lynx, wget # cd /Packages # rpm -ivh lynx-2.8.8-0.3.dev15.el7.x86_64.rpm # rpm -ivh wget-1.14-18.el7.x86_64.rpm ・nkf # cd /usr/local/src # tar xzf /...anywhere.../nkf-2.1.5.tar.gz # rm -f /...anywhere.../nkf-2.1.5.tar.gz # cd nkf-2.1.5 # make # cp nkf /usr/local/bin # cd /usr/local/src # rm -Rf nkf-2.1.5 ・MariaDB(MySQL) # cd /Packages # rpm -ivh \ mariadb-5.5.60-1.el7_5.x86_64.rpm \ mariadb-server-5.5.60-1.el7_5.x86_64.rpm \ perl-DBD-MySQL-4.023-6.el7.x86_64.rpm ・Apache Web Server : HTTPD # cd /Packages # rpm -ivh \ mailcap-2.1.41-2.el7.noarch.rpm \ httpd-devel-2.4.6-88.el7.centos.x86_64.rpm \ httpd-2.4.6-88.el7.centos.x86_64.rpm \ apr-devel-1.4.8-3.el7_4.1.x86_64.rpm \ apr-util-devel-1.5.2-6.el7.x86_64.rpm \ httpd-tools-2.4.6-88.el7.centos.x86_64.rpm \ expat-devel-2.1.0-10.el7_3.x86_64.rpm \ libdb-devel-5.3.21-24.el7.x86_64.rpm \ openldap-devel-2.4.44-20.el7.x86_64.rpm \ cyrus-sasl-devel-2.1.26-23.el7.x86_64.rpm \ mod_ssl-2.4.6-88.el7.centos.x86_64.rpm ・PHP7 # cd /Packages # rpm -ivh \ libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm \ zlib-devel-1.2.7-18.el7.x86_64.rpm \ xz-devel-5.2.2-1.el7.x86_64.rpm \ openssl-devel-1.0.2k-16.el7.x86_64.rpm \ krb5-devel-1.15.1-34.el7.x86_64.rpm \ keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm \ libverto-devel-0.2.5-4.el7.x86_64.rpm \ libcom_err-devel-1.42.9-13.el7.x86_64.rpm \ libkadm5-1.15.1-34.el7.x86_64.rpm \ libselinux-devel-2.5-14.1.el7.x86_64.rpm \ libsepol-devel-2.5-10.el7.x86_64.rpm \ pcre-devel-8.32-17.el7.x86_64.rpm \ bzip2-devel-1.0.6-13.el7.x86_64.rpm \ libzip-0.10.1-8.el7.x86_64.rpm \ libcurl-devel-7.29.0-51.el7.x86_64.rpm # cd /usr/local/src # tar xzf /...anywhere.../php-7.3.2.tar.gz # rm -f /...anywhere.../php-7.3.2.tar.gz # cd php-7.3.2 # ./configure \ --enable-mbstring \ --enable-zip \ --enable-bcmath \ --enable-pcntl \ --enable-ftp \ --enable-exif \ --enable-calendar \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-wddx \ --enable-mysqlnd \ --with-curl \ --with-iconv \ --with-openssl \ --with-gettext \ --with-zlib \ --with-bz2 \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --without-libzip \ --with-apxs2=/usr/bin/apxs # make && make install ・TeX # cd /Packages # rpm -ivh \ perl-Digest-MD5-2.52-3.el7.x86_64.rpm \ perl-Digest-1.17-245.el7.noarch.rpm # mount -t iso9660 -o loop /...anywhere.../texlive2018-20180414.iso /mnt # cd /mnt # ./install-tl [I] <--- check ......... ......... ......... Welcome to TeX Live! See /usr/local/texlive/2018/index.html for links to documentation. The TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html. Add /usr/local/texlive/2018/texmf-dist/doc/man to MANPATH. Add /usr/local/texlive/2018/texmf-dist/doc/info to INFOPATH. Most importantly, add /usr/local/texlive/2018/bin/x86_64-linux to your PATH for current and future sessions. Logfile: /usr/local/texlive/2018/install-tl.log # cd # umount /mnt # rm -f /...anywhere.../texlive2018-20180414.iso -------------------------------------------------------------------------------- ・ミドルウェアの設定 ・MariaDB # cd /etc # cp my.cnf _my.cnf # vi my.cnf # diff _my.cnf my.cnf 9a10 > character-set-server=utf8 # systemctl enable mariadb.service # systemctl start mariadb.service # /usr/bin/mysql_secure_installation # mysql -u root -p ・Apache WEB Server # systemctl enable httpd # systemctl start httpd # cd /etc/httpd/conf # cp httpd.conf _httpd.conf # vi httpd.conf # diff _httpd.conf httpd.conf 104c104 < AllowOverride none --- > AllowOverride All 152c152 < AllowOverride None --- > AllowOverride All 165c165 < DirectoryIndex index.html --- > DirectoryIndex index.php index.html 257c257 < AllowOverride None --- > AllowOverride FileInfo 354a355,360 > > # > # PHP > # > AddType application/x-httpd-php .php > AddType application/x-httpd-php-source .phps # systemctl restart httpd -------------------------------------------------------------------------------- ・その他の設定 ・Webサーバー(http)のサービス(ポート)を永続的に許可 間違えて設定してしまった場合は「add」の箇所を「remove」にする。 # firewall-cmd --permanent --add-service=http ・httpsサーバーのサービス(ポート)を永続的に許可 # firewall-cmd --permanent --add-service=https ・firewalldを状態の情報を失わずにリロードする。これで設定が有効になる。 # firewall-cmd --reload ・現在有効な機能とゾーンを一覧表示します。 # firewall-cmd --list-all # firewall-cmd --list-all-zones # firewall-cmd --list-all --permanent ・アクティブゾーンの確認 # firewall-cmd --get-active-zones ・設定内容の確認 # cat /etc/firewalld/zones/public.xml ・設定内容の確認 個別 https # ls /usr/lib/firewalld/services # less /usr/lib/firewalld/services/https.xml -------------------------------------------------------------------------------- MariaDBを外部らかアクセス CREATE USER 'root'@'192.168.3.%' IDENTIFIED BY '..password..'; GRANT ALL ON *.* TO 'root'@'192.168.3.%'; SELECT User,Host FROM mysql.user; # firewall-cmd --zone=public --add-port=3306/tcp --permanent # firewall-cmd --reload # firewall-cmd --list-ports -------------------------------------------------------------------------------- Java-SE # rpm -ivh /...anywhere.../jdk-12.0.1_linux-x64_bin.rpm # rm -f /...anywhere.../jdk-12.0.1_linux-x64_bin.rpm -------------------------------------------------------------------------------- TOMCAT # useradd -s /sbin/nologin tomcat # cd /usr/local # tar xzf /...anywhere.../apache-tomcat-9.0.19.tar.gz # chown -R tomcat:tomcat /usr/local/apache-tomcat-9.0.19 # ln -s /usr/local/apache-tomcat-9.0.19 /usr/local/tomcat # vi /etc/profile <<< 追加 JAVA_HOME=/usr/java/default CATALINA_HOME=/usr/local/tomcat export JAVA_HOME CATALINA_HOME >>> # exit ここでOSをリブートし、再びrootでログイン。 # cp /usr/local/tomcat/bin/commons-daemon-native.tar.gz /tmp # rm -f /usr/local/tomcat/bin/commons-daemon-native.tar.gz # cd /tmp # tar xvzf commons-daemon-native.tar.gz # cd commons-daemon-1.1.0-native-src/unix # ./configure # make # cp jsvc /usr/local/tomcat/bin # chown tomcat:tomcat /usr/local/tomcat/bin/jsvc # vi /etc/systemd/system/tomcat.service # cat /etc/systemd/system/tomcat.service [Unit] Description=Apache Tomcat Servlet Container After=syslog.target network.target [Service] Type=forking EnvironmentFile=/etc/sysconfig/tomcat ExecStart=/usr/local/tomcat/bin/startup.sh ExecStop=/usr/local/tomcat/bin/shutdown.sh KillMode=none [Install] WantedBy=multi-user.target # chmod 755 /etc/systemd/system/tomcat.service # vi /etc/sysconfig/tomcat # cat /etc/sysconfig/tomcat JAVA_HOME=/usr/java/default TOMCAT_HOME=/usr/local/tomcat CATALINA_HOME=/usr/local/tomcat # # systemctl daemon-reload # systemctl enable tomcat.service # systemctl start tomcat.service # systemctl status tomcat.service # firewall-cmd --zone=public --add-port=8080/tcp --permanent # firewall-cmd --reload -------------------------------------------------------------------------------- Java # vi /etc/profile.d/java.sh export JAVA_HOME=/usr/java/default export PATH=$JAVA_HOME/bin:$PATH export TOMCAT_HOME=/usr/local/tomcat export CATALINA_HOME=/usr/local/tomcat export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib リブート -------------------------------------------------------------------------------- eclipse # cd /usr/local # tar -xvzof /...anywhere.../eclipse-jee-2019-03-R-linux-gtk-x86_64.tar.gz # rm -f /...anywhere.../eclipse-jee-2019-03-R-linux-gtk-x86_64.tar.gz $ cd $ mkdir eclipse-workspace $ /usr/local/eclipse/eclipse & -------------------------------------------------------------------------------- STS (Spring Tool Suite) # cd /usr/local/ # tar xzf /...anywhere.../spring-tool-suite-4-4.2.1.RELEASE-e4.11.0-linux.gtk.x86_64.tar.gz # rm -f /...anywhere.../spring-tool-suite-4-4.2.1.RELEASE-e4.11.0-linux.gtk.x86_64.tar.gz $ cd $ mkdir sts-workspace $ /usr/local/sts-4.2.1.RELEASE/SpringToolSuite4 & -------------------------------------------------------------------------------- COBOL # cd /Packages # rpm -ihv gmp-devel-6.0.0-15.el7.x86_64.rpm # xz -dv /...anywhere.../gnucobol-3.0-rc1.tar.xz # cd /usr/local # tar xf /...anywhere.../gnucobol-3.0-rc1.tar # rm -f /...anywhere.../gnucobol-3.0-rc1.tar # chown -R root:root gnucobol-3.0-rc1 # cd gnucobol-3.0-rc1 # ./configure # make && make install Manual https://open-cobol.sourceforge.io/doc/gnucobol.html $ cd $ vi .bash_profile $ tail -2 .bash_profile LD_LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH $ exit 再ログイン $ vi hello.cob $ cat hello.cob * コメント * * * IDENTIFICATION DIVISION. PROGRAM-ID. SAMPLE-01. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. MAIN. DISPLAY "Hello world!" UPON CONSOLE. STOP RUN. $ cobc -x hello.cob # ./hello Hello world! $ -------------------------------------------------------------------------------- GIT # rpm -ivh \ perl-ExtUtils-MakeMaker-6.68-3.el7.noarch.rpm \ perl-ExtUtils-Install-1.58-293.el7.noarch.rpm \ perl-ExtUtils-Manifest-1.61-244.el7.noarch.rpm \ perl-devel-5.16.3-293.el7.x86_64.rpm \ perl-ExtUtils-ParseXS-3.18-3.el7.noarch.rpm \ gdbm-devel-1.10-8.el7.x86_64.rpm \ systemtap-sdt-devel-3.3-3.el7.x86_64.rpm \ pyparsing-1.5.6-9.el7.noarch.rpm 本来ならば以下のrpmも必要だが、これらは既にインストールされている。 zlib-devel-1.2.7-18.el7.x86_64.rpm \ openssl-devel-1.0.2k-16.el7.x86_64.rpm \ autoconf-2.69-11.el7.noarch.rpm \ gettext-devel-0.19.8.1-2.el7.x86_64.rpm \ expat-devel-2.1.0-10.el7_3.x86_64.rpm \ libcurl-devel-7.29.0-51.el7.x86_64.rpm \ # cd /usr/local # xz -dv /...anywhere.../git-2.9.5.tar.xz # tar xf /...anywhere.../git-2.9.5.tar # rm -f /...anywhere.../git-2.9.5.tar # cd git-2.9.5 # make configure # make all && make install # git --version --------------------------------------------------------------------------------