----------
FTP
----------
1.在最小化安装的系统中安装 vim 和 ifconfig
yum -y install vim
yum -y install net-tools
2.利用vsftp创建虚拟帐号访问FTP
(先得搞定本地账户)
yum -y install vsftpd
systemctl stop firewalld.service //关闭防火墙
setenforce 0
getenforce //查看状态
service vsftpd start //启动
/etc/vsftpd/vsftpd.conf //配置文件
useradd -s /sbin/nologin -d /home/MyFTP uftp
passwd uftp (123456789)
测试能否访问:
测试put get
如果不能:vim /etc/pam.d/vsftpd -> 注释掉#auth required pam_shells.so
3.haha,hehe(123)
vim /etc/pam.d/vsftpd //修改后本地用户就不能访问了
先注释原来的
auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
echo haha >> /etc/vsftpd/vuser_passwd.txt
echo 123456 >> /etc/vsftpd/vuser_passwd.txt
echo hehe >> /etc/vsftpd/vuser_passwd.txt
echo 123456 >> /etc/vsftpd/vuser_passwd.txt
cd /etc/vsftpd/
db_load -T -t hash -f vuser_passwd.txt vuser_passwd.db
4.hehe能上传下载,haha只能下载
mkdir vuser_conf
cd vuser_conf/
vim haha
local_root=/home/MyFTP
anon_umask=022
anon_world_readable_only=no
vim hehe
local_root=/home/MyFTP
write_enable=YES
anon_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
vim /etc/vsftpd/vsftpd.conf
guest_enable=YES
guest_username=uftp
user_config_dir=/etc/vsftpd/vuser_conf
allow_writeable_chroot=YES
service vsftpd restart
5.使用centos的ftp工具演示
ftp 192.168.~~~~
put
get
----------
lamp
----------
1.在最小化安装的系统中安装.m 和 ifconfig
2.使用光盘镜像的yum源安装
mkdir /media/cdrom
mount /dev/sr0 /media/cdrom #挂载光盘
cd /etc/yum.repos.d/
只剩下Media....
vim media这个源 enable=1
3.安装lamp环境
yum -y install httpd
yum -y install mysql
yum -y install php
4.apache本地目录指定:/var/www/html/hehe
apache配置文件:cd /etc/httpd/conf
service httpd restart
cd /var/www/html
mkdir hehe
5.访问http://ip/hehe 呈现phpinfo()内容
cd hehe
vim index.php (<?php phpinfo();?>)
-------------
源码安装apache
-------------
1.在最小化安装的系统中安装 vim 和 ifconfig
2.源码安装apache
yum -y install wget
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.39.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-1.6.5.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
tar zxf httpd-2.4.39.tar.gz
tar zxf apr-1.6.5.tar.gz
tar zxf apr-util-1.6.1.tar.gz
yum -y install gcc
cd apr-1.6.5
./configure
make && make install
cd ..
cd apr-util-1.6.1
yum -y install expat-devel
./configure --with-apr=/usr/local/apr/ --prefix=/usr/local/apr-util
make && make install
cd ..
cd httpd-2.4.39
yum -y install pcre-devel
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-mpm=worker --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
make && make install
/usr/local/apache2/bin/apachectl start
//启动
3.修改apache的端口号8888
4.修改网站根目录:/hehe
mkdir /hehe
cd /hehe
vim /usr/local/apache2/conf/httpd.conf
5.在网站根目录能查看phpinfo
vim index.php
/usr/local/apache2/bin/apachectl restart
***PHP文件无法解析 -> 需要安装PHP7.2***
--------
源码安装:
--------
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libzip-devel pcre-devel
cd /root
wget https://www.php.net/distributions/php-7.3.6.tar.gz
mkdir /usr/local/php7
tar -zxf php-7.3.6.tar.gz #解压源码包
cd cd php-7.3.6 #进入源码包目录
./configure --prefix=/usr/local/php7/ --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --with-curl --with-gd --enable-fpm --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-config-file-path=/usr/local/php71/etc/ --with-mysqli=mysqlnd
make && make install
#配置文件
/root/php-7.3.6
cp php.ini-development /usr/local/php7/etc/php.ini
vim /usr/local/apache2/conf/httpd.conf
Addtype application/x-httpd-php .php
/usr/local/apache2/bin/apachectl restart
虚拟机DNS
手工修改 /etc/resolv.conf
nameserver 114.114.114.114
nameserver 宿主机IP