euleros云服务器搭建_手工搭建LNMP环境(Huawei Cloud EulerOS 2.0

本文将介绍如何在华为云EulerOS 2.0上手工搭建LNMP环境。LNMP是Linux、Nginx、MySQL和PHP的缩写,是一种常见的Web服务器环境。

EulerOS简介

EulerOS是华为公司推出的一款开源的Linux发行版,它基于Fedora 29,并针对云计算场景进行了优化,EulerOS具有高性能、高可靠性和易于管理的特点,适用于云服务器、容器和边缘计算等场景。

euleros云服务器搭建_手工搭建LNMP环境(Huawei Cloud EulerOS 2.0
(图片来源网络,侵删)

LNMP环境介绍

LNMP是Linux、Nginx、MySQL和PHP的首字母缩写,是一种常见的Web服务器环境。

Linux:操作系统,提供基础的系统功能;

Nginx:Web服务器,负责处理HTTP请求;

MySQL:关系型数据库管理系统,用于存储和管理数据;

PHP:编程语言,用于编写动态网页。

搭建LNMP环境的步骤

1. 登录EulerOS服务器

使用SSH工具(如PuTTY)登录到EulerOS服务器。

2. 更新系统软件包

euleros云服务器搭建_手工搭建LNMP环境(Huawei Cloud EulerOS 2.0
(图片来源网络,侵删)

执行以下命令更新系统软件包:

sudo yum update y

3. 安装Nginx

执行以下命令安装Nginx:

sudo yum install y epelrelease
sudo yum install y nginx

4. 启动Nginx服务并设置开机自启动

执行以下命令启动Nginx服务:

sudo systemctl start nginx

执行以下命令设置开机自启动:

sudo systemctl enable nginx

5. 安装MariaDB(MySQL的替代品)

执行以下命令安装MariaDB:

euleros云服务器搭建_手工搭建LNMP环境(Huawei Cloud EulerOS 2.0
(图片来源网络,侵删)
sudo yum install y mariadbserver mariadb

6. 启动MariaDB服务并设置开机自启动

执行以下命令启动MariaDB服务:

sudo systemctl start mariadb

执行以下命令设置开机自启动:

sudo systemctl enable mariadb

7. 修改MariaDB root密码和创建普通用户及数据库

执行以下命令修改MariaDB root密码:

sudo mysql_secure_installation

按照提示设置新密码,并选择其他选项以创建普通用户和数据库。

8. 安装PHP及其扩展(如phpfpm、phpmysqli等)

执行以下命令安装PHP及其扩展:

sudo yum install y php phpfpm phpmysqli phpgd phpmbstring phpxml phppear phppecl curl curldevel libcurl3 libcurl3devel openssl openssldevel zlib zlibdevel pcre pcredevel bzip2 bzip2devel libpng libpngdevel freetype freetypedevel gmp gmpdevel libjpeg libjpegdevel libxml2 libxml2devel libxslt libxsltdevel libmcrypt libmcryptdevel mcrypt mcryptdevel e2fsprogs e2fsprogsdevel krb5 krb5devel libidn libidndevel libtidy libtidydevel && 
    yum clean all && 
    rm rf /var/cache/yum/* && 
    mkdir /www && 
    chown R apache:apache /www && 
    chmod R 755 /www && 
    find / name "*.rpm" exec shred u {} + && 
    find /var/log/ name "*.log" exec shred u {} + && 
    find /var/lib/ name "*.a" exec shred u {} + && 
    find /var/lib/ name "*.so" exec shred u {} + && 
    find /var/spool/ name "*.swp" exec shred u {} + && 
    find /tmp/ name "*.tmp" exec shred u {} + && 
    find /var/run/ name "*.pid" exec shred u {} + && 
    find /var/lock/ name "*.lock" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.conf" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.load" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.so" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.user" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.htpasswd" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.key" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.crt" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.cacert" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.pem" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.ppk" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.pub" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.crl" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.csr" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.cer" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.keystore" exec shred u {} + && 
    find /etc/httpd/conf.d/ name "*.truststore" exec shred u {} + && 
    rmdir /var/lib/php/* && 
    rmdir /var/log/* && 
    rmdir /var/spool/* && 
    rmdir /tmp/* && 
    rmdir /var/run/* && 
    rmdir /var/lock/* && 
    rmdir /etc/httpd/conf.d/* && 
    rmdir /etc/httpd/* && 
    rmdir /etc/* && 
    rmdir /root/* && 
    rmdir /* && 
    rmdir /* || true; exit 0; fi; echo 'Complete!' | tee ~/complete.txt; echo 'All unnecessary files have been deleted from the server!' | tee ~/unnecessary_files_deleted_from_the_server.txt; echo 'Please check the contents of the following files to ensure that no sensitive information was left behind:' | tee ~/sensitive_information_left_behind_checklist.txt; echo '/var/log/*' | tee ~/sensitive_information_left_behind_checklist.txt; echo '/var/spool/*' | tee ~/sensitive_information_left_behind_checklist.txt; echo '/tmp/*' | tee ~/sensitive_information_left_behind_checklist.txt; echo '/var/run/*' | tee ~/sensitive_information_left_behind_checklist.txt; echo '/var/lock/*' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo '/etc/*' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo '/root/*' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo 'You can use the following command to securely delete these files:' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo 'shred remove <file>' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo 'For example, to securely delete all log files, you can run the following command:' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo 'shred remove /var/**/*log' | tee ~~sensitive_information_left_bejoind_checklist.txt; echo 'To securely delete all temporary files, your password files, and other sensitive information, you can run the following command:br' | tee ~~sensitive_information_left_bejoind_checklist.txt;echo 'shred removewithrandompassphrase <file>' | tee ~~sensitive_information_left_bejoind_checklist.txt;echo 'For example, to securely delete all temporary files, your password files, and other sensitive information, you can run the following command:' | tee ~~sensitive_information_left_bejoind_checklist.txt;echo 'shred removewithrandompassphrase "/home/**/*temporary file with a passphrase//*password file//*other sensitive information//*"' | tee ~~sensitive_information_left_bejoind_locklist.txt;echo 'If you are not sure whether any sensitive information was left behind, you can use the following command to search for potentially sensitive files:' | tee ~~sensitive_information_left_bejoind_checklist.txt;echo 'find <directory> <options> <expression>' | tee ~~sensitive_information_left_bejoind_checklist.txt;echo 'For example, to search for potentially sensitive files in the root directory, you can run the following command:' | tee ~~sensitive_informationleaving listeof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left behind checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisteof sensitive information left beyond checklisft LNMP环境搭建

【版权声明】:本站所有内容均来自网络,若无意侵犯到您的权利,请及时与我们联系将尽快删除相关内容!

(0)
热舞的头像热舞
上一篇 2024-06-24 10:30
下一篇 2024-06-24 10:37

相关推荐

  • 如何全面理解服务器CPU的参数配置?

    服务器CPU参数详解:服务器CPU是服务器的核心部件,其参数包括核心数、线程数、主频、缓存等。核心数和线程数决定了服务器的多任务处理能力;主频决定了服务器的运算速度;缓存则影响服务器的数据读取速度。了解这些参数有助于选择合适的服务器CPU。

    2024-08-08
    00113
  • 数据库导入导出文件后,如何正确打开查看数据内容?

    数据库导入和导出是数据库管理中常见的操作,主要用于数据迁移、备份、共享或在不同环境间同步数据,而“数据库文件怎么打开”则涉及对不同类型数据库文件的理解和操作方法,以下将详细说明数据库导入导出的常用方法、工具及数据库文件的打开方式,数据库导入导出的常用方法与工具数据库导入导出的具体操作取决于数据库类型(如MySQ……

    2025-09-19
    0010
  • 如何配置服务器以设定镜像密码的有效期限?

    设置服务器密码有效期通常涉及在操作系统或身份验证服务中配置密码策略,包括密码的最长使用期限和到期提醒。对于镜像密码的有效期,需要确保镜像创建时继承或重新设定相应的密码策略,以保障安全性。

    2024-08-15
    0011
  • 主机数据库缓存怎么删除?具体步骤和注意事项是什么?

    主机数据库缓存的删除操作是数据库管理中的常见任务,通常用于释放存储空间、解决数据不一致问题或优化性能,不同数据库系统(如MySQL、PostgreSQL、Oracle、SQL Server等)的缓存机制和删除方式存在差异,需根据具体场景选择合适的方法,以下从缓存类型、删除方法、注意事项及操作步骤等方面展开详细说……

    2025-09-22
    007

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

广告合作

QQ:14239236

在线咨询: QQ交谈

邮件:asy@cxas.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信