首页 > 其他分享 >LAMP

LAMP

时间:2023-08-22 19:57:22浏览次数:32  
标签:httpd local LAMP usr mysql root localhost

目录

1. 编译安装Apache HTTP服务

[root@localhost ~]#systemctl stop firewalld.service
[root@localhost ~]#setenforce 0
 [root@localhost ~]#kill 2585
 [root@localhost ~]#yum install gcc gcc-c++ make pcre-devel expat-devel perl pcre -y

[root@localhost ~]#cd /opt
[root@localhost opt]#rz -E
[root@localhost opt]#tar xf apr-util-1.6.0.tar.gz
[root@localhost opt]#tar xf apr-1.6.2.tar.gz
[root@localhost opt]#tar xf httpd-2.4.29.tar.bz2
[root@localhost opt]#ls
[root@localhost opt]#mv apr-1.6.2 /opt/httpd-2.4.29/srclib/apr
[root@localhost opt]#mv apr-util-1.6.0 /opt/httpd-2.4.29/srclib/apr-util
[root@localhost opt]#cd /opt/httpd-2.4.29/
[root@localhost httpd-2.4.29]#./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
[root@localhost httpd-2.4.29]#make -j2 && make install
[root@localhost httpd-2.4.29]#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost httpd-2.4.29]#ln -s /usr/local/httpd/conf/httpd.conf /etc/
[root@localhost httpd-2.4.29]#ln -s /usr/local/httpd/bin/* /usr/local/bin/
[root@localhost httpd-2.4.29]#ls /usr/local/httpd
[root@localhost httpd-2.4.29]#httpd -t
[root@localhost httpd-2.4.29]#vi /etc/init.d/httpd
#开头加入
# chkconfig: 35 85 21         //35级别自动运行  第85个启动 第21个关闭
# description: Apache is a World Wide Web server

[root@localhost httpd-2.4.29]#chkconfig --add httpd
[root@localhost httpd-2.4.29]#service httpd start
[root@localhost httpd-2.4.29]#vim /etc/httpd.conf
51 Listen 192.168.91.100:80       #将你的地址加入
52 #Listen                        #52注释掉
199 ServerName www.example.com    #写入域名

[root@localhost httpd-2.4.29]#service httpd start
[root@localhost httpd-2.4.29]#ss -natp | grep 80

浏览器192.168.8.100

2. 编译安装MySQL

[root@localhost ~]#cd /data
[root@localhost data]#
[root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#tar xf mysql-boost-5.7.20.tar.gz
[root@localhost data]#ls
mysql-5.7.20  mysql-boost-5.7.20.tar.gz
[root@localhost data]#cd mysql-5.7.20/
[root@localhost mysql-5.7.20]#ls
boost           config.h.cmake       extra                libmysql     mysys_ssl  scripts        testclients
BUILD           configure.cmake      include              libmysqld    packaging  sql            unittest
client          COPYING              INSTALL              libservices  plugin     sql-common     VERSION
cmake           dbug                 libbinlogevents      man          rapid      storage        vio
CMakeLists.txt  Docs                 libbinlogstandalone  mysql-test   README     strings        win
cmd-line-utils  Doxyfile-perfschema  libevent             mysys        regex      support-files  zlib

[root@localhost mysql-5.7.20]#yum install -y ncurses-devel autoconf cmake

[root@localhost mysql-5.7.20]#cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1

[root@localhost mysql-5.7.20]#make -j2 && make install
[root@localhost mysql-5.7.20]#useradd -s /sbin/nologin  mysql
[root@localhost mysql-5.7.20]#chown -R mysql:mysql /usr/local/mysql/
[root@localhost mysql-5.7.20]#vim /etc/my.cnf
[client]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock

[mysql]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock

[mysqld]
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306  #mysq数据库端口号
character_set_server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket = /usr/local/mysql/mysql.sock
server-id = 1  #主从

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES

[root@localhost mysql-5.7.20]#chown mysql:mysql /etc/my.cnf
[root@localhost mysql-5.7.20]#echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
[root@localhost mysql-5.7.20]#echo 'export PATH' >> /etc/profile
[root@localhost mysql-5.7.20]#. /etc/profile
[root@localhost mysql-5.7.20]#echo $PATH
/usr/local/mysql/bin:/usr/local/mysql/lib:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost mysql-5.7.20]#cd /usr/local/mysql
[root@localhost mysql]#ls
bin  COPYING  COPYING-test  docs  include  lib  man  mysql-test  README  README-test  share  support-files  usr
[root@localhost mysql]#bin/mysqld \
> --initialize-insecure \
> --user=mysql \
> --basedir=/usr/local/mysql \
> --datadir=/usr/local/mysql/data
[root@localhost mysql]#ls
bin      COPYING-test  docs     lib  mysql-test  README-test  support-files
COPYING  data          include  man  README      share        usr
[root@localhost mysql]#ls data/
auto.cnf  ib_buffer_pool  ibdata1  ib_logfile0  ib_logfile1  mysql  performance_schema  sys
[root@localhost mysql]#cp usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
[root@localhost mysql]#systemctl daemon-reload
[root@localhost mysql]#systemctl start mysqld.service
[root@localhost mysql]#ss -natp | grep 3306
LISTEN     0      80          :::3306                    :::*                   users:(("mysqld",pid=105954,fd=21))

[root@localhost mysql]#mysqladmin -u root -p password "abc123"
Enter password: 
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

[root@localhost mysql]#mysql -uroot -p"abc123"
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.20 Source distribution

Copyright (c) 2000, 2017, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[root@localhost mysql]#

[root@localhost mysql]#yum -y install \
> gd \
> libjpeg libjpeg-devel \
> libpng libpng-devel \
> freetype freetype-devel \
> libxml2 libxml2-devel \
> zlib zlib-devel \
> curl curl-devel \
> openssl openssl-devel


[root@localhost mysql]#cd /data
[root@localhost data]#ls
mysql-5.7.20  mysql-boost-5.7.20.tar.gz
[root@localhost data]#
[root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#ls
Discuz_X3.4_SC_UTF8.zip  mysql-5.7.20  mysql-boost-5.7.20.tar.gz  php-7.1.10.tar.bz2

[root@localhost data]#tar xf php-7.1.10.tar.bz2 
[root@localhost data]#ls
Discuz_X3.4_SC_UTF8.zip  mysql-5.7.20  mysql-boost-5.7.20.tar.gz  php-7.1.10  php-7.1.10.tar.bz2
[root@localhost data]#cd php-7.1.10/
[root@localhost php-7.1.10]#ls
[root@localhost php-7.1.10]#./configure \
--prefix=/usr/local/php7 \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-config-file-path=/usr/local/php7 \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip

[root@localhost php-7.1.10]#make -j2 && make install
[root@localhost php-7.1.10]#cp /data/php-7.1.10/php.ini-development /usr/local/php7/php.ini
[root@localhost php-7.1.10]#vim /usr/local/php7/php.ini
mysqli.default_socket = /usr/local/mysql/mysql.sock   --1170行--修改 1170 G,大写的G,直接跳转
date.timezone = Asia/Shanghai       --939行--修改

[root@localhost php-7.1.10]#ln -s /usr/local/php7/bin/* /usr/local/bin/
[root@localhost php-7.1.10]#php -m
[root@localhost php-7.1.10]#vim /etc/httpd.conf
#   --393行修改  393G
#                             AddType application/x-httpd-php .php
#这里的点前面空格一定要加,否则报错 AddType application/x-httpd-php-source .phps

#  --255行修改 
#<IfModule dir_module>
#    DirectoryIndex index.html  index.php
#</IfModule>


[root@localhost php-7.1.10]#httpd -t
Syntax OK
[root@localhost php-7.1.10]#service httpd restart


[root@localhost php-7.1.10]#vim /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>

3. 安装论坛

[root@localhost php-7.1.10]#cd /data
[root@localhost data]#mysql -uroot -p"abc123"
mysql> CREATE DATABASE oop;  #创建一个数据库
Query OK, 1 row affected (0.00 sec)

mysql> GRANT all ON oop.* TO 'oopuser'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| oop                |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> select user,host from mysql.user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| oopuser       | %         |
| mysql.session | localhost |
| mysql.sys     | localhost |
| root          | localhost |
+---------------+-----------+
4 rows in set (0.00 sec)

mysql> flush privileges;   #刷新数据库
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
![](/i/l/?n=23&i=blog/2937119/202308/2937119-20230822194052399-491376772.png)

[root@localhost data]#
[root@localhost data]#unzip Discuz_X3.4_SC_UTF8.zip 
[root@localhost data]#ls
dir_SC_UTF8              mysql-5.7.20               php-7.1.10          说明.htm
Discuz_X3.4_SC_UTF8.zip  mysql-boost-5.7.20.tar.gz  php-7.1.10.tar.bz2

[root@localhost data]#cd dir_SC_UTF8/
[root@localhost dir_SC_UTF8]#ls
readme  upload  utility
[root@localhost dir_SC_UTF8]#cp -r upload/ /usr/local/httpd/htdocs/oop
[root@localhost dir_SC_UTF8]#cd /usr/local/httpd/
[root@localhost httpd]#ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules
[root@localhost httpd]#cd htdocs/
[root@localhost htdocs]#ll
总用量 12
-rw-r--r--.  1 root root   45 6月  12 2007 index.html
-rw-r--r--.  1 root root   20 8月  22 17:10 index.php
drwxr-xr-x. 13 root root 4096 8月  22 19:05 oop
[root@localhost htdocs]#cd oop
[root@localhost oop]#chown -R daemon ./config
[root@localhost oop]#chown -R daemon ./data
[root@localhost oop]#chown -R daemon ./uc_client
[root@localhost oop]#chown -R daemon ./uc_server/data
[root@localhost ddh]#ll
[root@localhost oop]#cd -
/usr/local/httpd/htdocs
[root@localhost htdocs]#chown -R daemon oop/
[root@localhost htdocs]#ll oop

192.168.8.100/oop/install




192.168.8.100/oop/

4. 安装wordpress

[root@localhost htdocs]#cd /data
[root@localhost data]#ls
dir_SC_UTF8              mysql-5.7.20               php-7.1.10           说明.htm
Discuz_X3.4_SC_UTF8.zip  mysql-boost-5.7.20.tar.gz  php-7.1.10.tar.bz2  [root@localhost data]#rz -E
rz waiting to receive.
[root@localhost data]#ls
dir_SC_UTF8              mysql-5.7.20               php-7.1.10          说明.htm
Discuz_X3.4_SC_UTF8.zip  mysql-boost-5.7.20.tar.gz  php-7.1.10.tar.bz2  wordpress-6.3-zh_CN.zip
[root@localhost data]#unzip wordpress-6.3-zh_CN.zip 
[root@localhost data]#ls
dir_SC_UTF8              mysql-5.7.20               php-7.1.10          wordpress                说明.htm
Discuz_X3.4_SC_UTF8.zip  mysql-boost-5.7.20.tar.gz  php-7.1.10.tar.bz2  wordpress-6.3-zh_CN.zip
[root@localhost data]#cp -a wordpress /usr/local/httpd/htdocs/
[root@localhost data]#cd /usr/local/httpd/
[root@localhost httpd]#ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules
[root@localhost httpd]#cd htdocs/
[root@localhost htdocs]#ls
index.html  index.php  oop  wordpress
[root@localhost htdocs]#chown -R daemon wordpress/
[root@localhost htdocs]#ll
总用量 16
-rw-r--r--.  1 root   root   45 6月  12 2007 index.html
-rw-r--r--.  1 root   root   20 8月  22 17:10 index.php
drwxr-xr-x. 13 daemon root 4096 8月  22 19:05 oop
drwxr-xr-x.  5 daemon root 4096 8月  17 23:00 wordpress
[root@localhost htdocs]#ll wordpress/





[root@localhost htdocs]#cd /data
[root@localhost data]#mysql -uroot -p"abc123"
mysql> CREATE DATABASE blog;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT all ON blog.* TO 'bloguser'@'%' IDENTIFIED BY 'admin123';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| blog               |
| mysql              |
| oop                |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

mysql> select user,host from mysql.user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| bloguser      | %         |
| oopuser       | %         |
| mysql.session | localhost |
| mysql.sys     | localhost |
| root          | localhost |
+---------------+-----------+
5 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

http://192.168.8.100/wordpress/wp-admin/setup-config.php






标签:httpd,local,LAMP,usr,mysql,root,localhost
From: https://www.cnblogs.com/LJ69/p/17649547.html

相关文章

  • LAMP搭建流程与应用
    LAMP搭建流程1、环境准备 [root@localhostopt]#systemctlstopfirewalld.service [root@localhostopt]#setenforce02、安装环境依赖包 [root@localhostopt]#yuminstall-y\ gcc\        #c语言编译器 gcc-c++\      #c编译......
  • 在 Amazon Linux 2023 上安装 LAMP
    通过以下步骤,您可以将带PHP和 MariaDB(一个由社区开发的MySQL分支)支持的ApacheWeb服务器(有时称为LAMPWeb服务器或LAMP堆栈)安装到AmazonLinux2023实例上。您可以使用此服务器来托管静态网站或部署能对数据库中的信息执行读写操作的动态PHP应用程序。重要这......
  • Ubuntu 20 Lamp安装配置
    安装nginxsudoaptupdatesudoaptinstallnginx安装php7.41.add-apt-repositoryppa:ondrej/php2.apt-getupdate3.apt-getinstallphp7.4php7.4-commonphp7.4-cliapt-getinstallphp7.4-curlphp7.4-jsonphp7.4-gdphp7.4-mbstringphp7.4-intlphp7.4-bc......
  • LNMP架构和LAMP架构对比
    Linux+Nginx+MySQL+PHPLinux+apache+mysql+php图解: ......
  • centos7上源码编译安装LAMP的多虚拟主机wordpress,discuz,用lamp.sh脚本实现
    环境:centos7.4apr-1.6.3.tar.gzapr-util-1.6.1.tar.gzhttpd-2.4.33.tar.bz2mariadb-10.2.15-linux-x86_64.tar.gzphp-7.1.18.tar.bz2wordpress-4.9.4-zh_CN.tar.gz1安装包:yumgroupinstall"developmenttools"yuminstallpcre-develope......
  • LNMP 和 LAMP 对比 (仅供参考)
    Nginx性能稳定、功能丰富、运维简单、处理静态文件速度快且消耗系统资源极少。Apache是LAMP架构最核心的WebServer,开源、稳定、模块丰富是Apache的优势。但Apache的缺点是有些臃肿,内存和CPU开销大,性能上有损耗,不如一些轻量级的Web服务器 至于安装哪个好呢? 要省......
  • Lamps(STL+双端队列)
     Lamps题面翻译有$n$盏灯,每盏灯有不亮,亮,坏掉3种状态。一开始每盏灯都不亮。第$i$盏灯有属性$a_i,b_i$。每次操作你可以选择一盏灭的灯将其点亮,并得到$b_i$的分数。每次操作结束后,记有$x$盏灯亮着,则所有$a_i\lex$的灯$i$都会损坏(无论是否亮着)。求能得到的最......
  • 在centos8中源码部署LAMP
    源码部署LAMP一、安装httpd在官网下载安装包http://archive.apache.org/[root@localhost~]#wgethttp://archive.apache.org/dist/apr/apr-1.7.4.tar.gz[root@localhost~]#wgethttp://archive.apache.org/dist/apr/apr-util-1.6.3.tar.gz[root@localhost~]#wgethttp:......
  • LAMP
    LAMP1.lamp简介有了前面学习的知识的铺垫,今天可以来学习下第一个常用的web架构了。所谓lamp,其实就是由Linux+Apache+Mysql/MariaDB+Php/Perl/Python的一组动态网站或者服务器的开源软件,除Linux外其它各部件本身都是各自独立的程序,但是因为经常被放在一起使用,拥有了越来越高的......
  • linux搭建LAMP环境
    LAMP环境指在linux系统下搭建Apache服务器+mysql+php(1)安装Apache服务及其扩展包yum-yinstallhttpdhttpd-manualmod_sslmod_perlmod_auth_mysql(2)启动Apache服务systemctlstarthttpd.service(3)安装mysql  wgethttp://dev.mysql.com/get/mysql57-community-release......