インストールのシステム環境
CentOSの6.8 64魏
JDKのバージョン
7u80 64魏
Tomcatのバージョン
Tomcat7
Mavenのバージョン
ApacheのMavenの3.6.0
vsftpdのバージョン
vsftpdは、2.2.2-24.el6.x86_64
nginxのバージョン
nginxの-1.14.2
MySQLのバージョン
MySQLのサーバ-5.1.73-8.el6_8.x86_64
gitのバージョン
gitのバージョン2.18.0
#备份
[root@192 yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#下载新的CentOS-Base.repo 到/etc/yum.repos.d/
[root@192 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
#生成缓存
[root@192 yum.repos.d]# yum makecache
ファイアウォールの設定をオフにすると
[root@192 vsftpd]# chkconfig iptables off
JDKのインストール
デフォルトでは、システムをクリーンアップし、JDKに付属しています
[root@192 yum.repos.d]# rpm -qa | grep jdk
java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
[root@192 yum.repos.d]# yum remove java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
[root@192 yum.repos.d]# yum remove java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
オーソライズ
[root@192 soft]# chmod 777 jdk-7u80-linux-x64.rpm
インストール
[root@192 soft]# rpm -ivh jdk-7u80-linux-x64.rpm
デフォルトのインストールパス/user/java
JDKの設定環境変数、編集し/etc/profile
たファイルを、追加
#jdk
export JAVA_HOME=/usr/java/jdk1.7.0_80
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
だから/etc/profile
、ファイルがすぐに有効になります
[root@192 apache-maven-3.6.0]# source /etc/profile
Tomcatのインストール
減圧
[root@192 soft]# tar -zxvf apache-tomcat-7.0.93.tar.gz -C /opt/module/
Tomcatの設定環境変数、編集し/etc/profile
たファイルを、追加
#tomcat
export CATALINA_HOME=/opt/module/apache-tomcat-7.0.93
export PATH=$PATH:$CATALINA_HOME/bin
だから/etc/profile
、ファイルがすぐに有効になります
[root@192 apache-maven-3.6.0]# source /etc/profile
Tomcatのインストールに、UTF-8文字セットの設定conf
、フォルダ、編集しserver.xml
たファイルを、8080のデフォルトのポート設定の場所を見つけ、XMLノードの最後に増加URIEncoding="UTF-8"
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />
Tomcatを起動し、入力し/opt/module/apache-tomcat-7.0.93/bin
たディレクトリを、実行./startup.sh
アクセスhttp://192.168.1.104:8080/
Mavenのインストール
減圧
[root@192 soft]# tar -zxvf apache-maven-3.6.0-bin.tar.gz -C /opt/module/
Mavenの設定環境変数、編集し/etc/profile
たファイルを、追加
#maven
export MAVEN_HOME=/opt/module/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME/bin
だから/etc/profile
、ファイルがすぐに有効になります
[root@192 apache-maven-3.6.0]# source /etc/profile
検証
[root@192 apache-maven-3.6.0]# mvn -version
インストールvsftpdの
インストール
[root@192 apache-maven-3.6.0]# yum -y install vsftpd
あなたがインストールされているかどうかを確認するには
[root@192 apache-maven-3.6.0]# rpm -qa | grep vsftpd
vsftpd-2.2.2-24.el6.x86_64
デフォルトの設定ファイル/etc/vsftpd/vsftpd.conf
仮想ユーザーを作成します。
FTPのルートディレクトリにフォルダを作成します。
[root@192 vsftpd]# cd /
[root@192 /]# mkdir ftpfile
匿名で追加されました
[root@192 /]# useradd ftpuser -d /ftpfile/ -s /sbin/nologin
パーミッションを変更しますFTPFILE
[root@192 /]# chown -R ftpuser.ftpuser /ftpfile/
あなたのパスワードをリセットFTPUSER
[root@192 /]# passwd ftpuser
ちょうどこの仮想ユーザープロファイルに追加されます
[root@192 ~]# cd /etc/vsftpd/
[root@192 vsftpd]# vim chroo_list
[root@192 bin]# cat /etc/vsftpd/chroo_list
ftpuser
設定ファイルを編集して/etc/vsftpd/vsftpd.conf
追加し、
local_root=/ftpfile
anon_root=/ftpfile
use_localtime=YES
anonymous_enable=no
500ログイン認証は、プロンプトが表示され、編集発生し/etc/selinux/config
たファイル、設定をSELINUX=disabled
[root@192 vsftpd]# vim /etc/selinux/config
あなたは500を報告している場合は、実行
[root@192 vsftpd]# setsebool -P ftp_home_dir 1
スタートvsftpdのサービスを設定します
[root@192 vsftpd]# chkconfig vsftpd on
nginxのをインストールします。
マウントされた信頼のgcc、PCRE、zlibの、OpenSSLの
[root@192 vsftpd]# yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
減圧
[root@192 soft]# tar -zxvf nginx-1.14.2.tar.gz -C /opt/module/
コンパイルとインストール
[root@192 nginx-1.14.2]# pwd
/opt/module/nginx-1.14.2
[root@192 nginx-1.14.2]# ./configure
[root@192 nginx-1.14.2]# make
[root@192 nginx-1.14.2]# make install
ビューnginxのインストールディレクトリ、バージョン
[root@192 nginx-1.14.2]# whereis nginx
nginx: /usr/local/nginx
[root@192 nginx-1.14.2]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.14.2
テストコンフィギュレーション・ファイルのnginx.conf
正しさ
[root@192 nginx-1.14.2]# /usr/local/nginx/sbin/nginx -t
スタートnginxの
[root@192 nginx-1.14.2]# /usr/local/nginx/sbin/nginx
[root@192 nginx-1.14.2]# ps -ef | grep nginx
root 5606 1 0 01:02 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 5607 5606 0 01:02 ? 00:00:00 nginx: worker process
root 5626 2868 0 01:09 pts/0 00:00:00 grep nginx
ストップnginxの
[root@192 nginx-1.14.2]# /usr/local/nginx/sbin/nginx -s stop
nginxの設定バーチャルドメイン
仮想ドメインマッピングの設定
[root@192 vhost]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#centos
#192.168.1.104 www.imooc.com
127.0.0.1 www.imooc.com
テスト
[root@192 sbin]# ping www.imooc.com
PING www.imooc.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.013 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.032 ms
編集し/usr/local/nginx/conf/nginx.conf
たファイルを、追加
###########################vhost##############################################
include vhost/*.conf;
では/usr/local/nginx/conf
、ディレクトリ、新しい作成しvhost
たフォルダを
では/usr/local/nginx/conf/vhost
、ディレクトリ、新しいドメインが転送www.mytest.com.conf
プロファイルを
[root@192 vhost]# cat /usr/local/nginx/conf/vhost/www.mytest.com.conf
#Start www.mytest.com
server {
listen 80;
server_name www.mytest.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.php;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}
# send request back to apach
location / {
proxy_pass http://127.0.0.1:8080/;
}
}
アクセスwww.mytest.com
前方静的リソースのnginxの構成
編集し/usr/local/nginx/conf/nginx.conf
たファイルを、追加
###########################vhost##############################################
include vhost/*.conf;
では/usr/local/nginx/conf
、ディレクトリ、新しい作成しvhost
たフォルダを
では/usr/local/nginx/conf/vhost
、ディレクトリ、新しいドメインが転送www.mytest.com.conf
プロファイルを
[root@192 vhost]# cat /usr/local/nginx/conf/vhost/www.mytest.com.conf
#Start www.mytest.com
server {
listen 80;
server_name www.mytest.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.php;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}
# send request back to apach
location / {
root /ftpfile/;
}
}
MySQLのインストール
インストール
[root@192 ~]# yum -y install mysql-server
文字セットの設定、編集し/etc/my.cnf
たファイルを、追加
#utf8
default-character-set=utf8
設定してmysql
システムを自動的に起動するサービスを
[root@192 ~]# chkconfig mysqld on
[root@192 ~]# chkconfig --list mysqld
mysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
スタートmysql
サービス
[root@192 ~]# service mysqld start
正在启动 mysqld: [确定]
非パスワードを使用して、ログイン
[root@192 mysql]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
ビューのmysql
ユーザー
mysql> select user,host,password from mysql.user;
+------+---------------+----------+
| user | host | password |
+------+---------------+----------+
| root | localhost | |
| root | 192.168.1.104 | |
| root | 127.0.0.1 | |
| | localhost | |
| | 192.168.1.104 | |
+------+---------------+----------+
5 rows in set (0.00 sec)
匿名ユーザーを削除します。
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec)
リフレッシュ、即時に有効
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
変更しroot
たパスワードを
mysql> set password for root@localhost=password("000000");
Query OK, 0 rows affected (0.00 sec)
MySQLは、新規ユーザを挿入します
mysql> insert into mysql.user(Host,User,Password) values("localhost","admin",password("000000"));
Query OK, 1 row affected, 3 warnings (0.01 sec)
ビューのユーザー権限
mysql> select * from mysql.user \G
*************************** 1. row ***************************
Host: localhost
User: root
Password: *032197AE5731D4664921A6CCAC7CFCE6A0698693
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
*************************** 2. row ***************************
Host: 192.168.1.104
User: root
Password:
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
*************************** 3. row ***************************
Host: 127.0.0.1
User: root
Password:
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
*************************** 4. row ***************************
Host: localhost
User: admin
Password: *032197AE5731D4664921A6CCAC7CFCE6A0698693
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
4 rows in set (0.00 sec)
ライブラリーをチェックし、新しいdatabase
データベース
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.01 sec)
mysql> create database mytest default character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| mytest |
| test |
+--------------------+
4 rows in set (0.00 sec)
ネットワークの権限外で開かれたすべてのアカウントに、すべてに付与されたローカルユーザー権限
mysql> grant all privileges on mytest.* to admin@'%' identified by '000000' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> grant select,delete,create on mytest.* to admin@'192.168.1.104' identified by '000000' with grant option;
Query OK, 0 rows affected (0.00 sec)
インポートsql
ファイルを
mysql> source /opt/module/mmall.sql
gitのインストール
減圧
[root@192 ~]# tar -zxvf git-2.18.0.tar.gz -C /opt/module/
インストールが依存します
[root@192 ~]# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker cpio
コンパイルとインストール
[root@192 git-2.18.0]# make prefix=/usr/local/ install
検証
[root@192 ~]# git --version
git version 2.18.0
公開鍵と秘密鍵のペアを生成します
[root@192 ~]# ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
85:1e:ef:5a:33:ab:e7:79:a4:46:f6:8e:8f:7f:af:cd [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| o . |
| . + |
| S . |
| .o . |
| o=+ |
| o+Bo .o |
| o=*=+..oE|
+-----------------+
SSHパブリッククラウドやGitHubのをコーディングする公開鍵をコピーして貼り付けます
[root@192 .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1sZvTnjQyVn7r2C7G9Q/WyVTTmJYqWhQdVfh3tBCUX8kJHaAcThwR4sl8ROz6xXl/22wbzlsKtfsiyr5zrV0Ifnq7KuCeNVNUYjOQCTn+ODaRzdj7DYC4Mz9BvxZAr0MDfSbgpLp6ZLAvZlkP3DioOPda7VnfJSAHGEYztOVPITj31pVnP1nXkPZRQlsTwImXEGJpuU+zOaurMShpaukrY/ONxWHR6xlG5M1FgOLdBvEnlbhOFoME1HHziI4/08Xw/NrHIUhvjZZgkAzWUo5NvYZLEwrUjOPtlVxHbYwBEtgBWRgWLFMfTlxQnEJVKzbwUDPLvZWac9WSpGLx5xiww== [email protected]
参照を提出する際、ユーザー名、電子メールの設定
[root@192 mytest]# git config --global user.name "shenlibng"
[root@192 mytest]# git config --global user.email "[email protected]"
[root@192 mytest]# git config --global core.autocrlf false
[root@192 mytest]# git config --global core.quotepath off
[root@192 mytest]# git config --global gui.encoding utf-8
ファイアウォールの設定を開きます。
ファイアウォールの初期設定を見ます
[root@192 ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
オープンTomcatのポート
有効にするには再起動してファイアウォール
[root@192 ~]# service iptables restart
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]
ファイアウォールの状態を確認します
[root@192 ~]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
6 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination