


A simple guide to setting up a LAMP vsftpd environment on CentOS, centosvsftpd_PHP tutorial
A simple guide to setting up a LAMP vsftpd environment on CentOS, centosvsftpd
VPS can be regarded as a server that only you use (in fact, it is a virtual machine) , you can install any software on it with maximum permissions. As the saying goes, with greater authority comes greater responsibility. You need to install the web server, database, PHP, and other maintenance work yourself.
The operating system provided by most VPS now is Linux, and it does not have a graphical interface. It only provides an SSH command line interface, so you need to know some simple Linux command lines. Linux has many distributions. The best distribution may be Redhat, but it is commercial software and cannot be used for free. Fortunately, it also has a community version CentOS, which completely uses the source code of Redhat and removes the Redhat LOGO. Replace it with your own and remove some closed source software, so the system functions, performance and stability are almost the same as Redhat, so I chose it.
Install Linux
For Linux installation, you can choose a distribution you are familiar with such as Ubuntu, Debian, Fedora, etc. The service provider will install it by default in a minimal installation mode. The version I chose is CentOS 6.3, taking into account the VPS memory Smaller, the 32-bit version is installed.
After installation, log in as the root user and allow the system to perform some necessary updates. Both Linux and Mac come with Terminal. If it is Windows, it is recommended to use PuTTY for SSH connection.
#以 root 用户登陆服务器 ssh root@198.xxx.xxx.xxx ... #系统更新 yum update ...
Install Apache
Apache is an old free and open source web server on the Linux platform. It is said that more than half of the websites in the world run on Apache. To install Apache, enter the following command at the command line:
yum install httpd
The Apache installed by default may not be the latest version, but it is the most stable version tested on this Linux version. If you must install the latest version, you need to download the latest version from the Apache official website.
After installation, execute the following command to start the Apache service:
service httpd start
The default web page storage directory is located in /var/www/html/, and then visit http://198.xxx.xxx.xxx in the browser. If a test page of Apache can appear, it means that Apache has been installed successfully. .
Install MySQL
MySQL is a very popular database software. It was originally developed by the Swedish company MySQL AB and was later acquired by Sun. It is currently a product of Oracle. The command to install MySQL is as follows:
yum install mysql-server
Start the MySQL service:
service mysqld start
Then you need to set a password for the MySQL root user. You can enter the following command:
/usr/bin/mysql_secure_installation
If you execute the above command, MySQL will ask you to provide the password of the current root user. Because we have just installed it, the password is empty. Just press Enter and set the new root user password.
There will then be some security options asking you to choose Y or N. For example, whether to remove anonymous login, whether to prevent root users from logging in remotely, if you select y, then root can only log in through localhost, and whether to remove the test database, refresh the permission table immediately, etc. The general situation is as follows:
[root@CentOS6 ~]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
Install PHP
PHP is a widely used open source dynamic scripting language. To install PHP and make it work with MySQL, you need to execute the following command:
yum install php php-mysql
At this time, you need to test whether PHP can work properly. You can create a test page.
#切换到 Apache 默认网页目录 cd /var/www/html #创建一个 php 脚本文件 touch phpinfo.php #向文件写入一小段 php 脚本,测试用 echo '<?php phpinfo(); ?>' > phpinfo.php <p># 因为刚刚安装了 PHP,所以别忘了重启一下 Apache,否则 PHP 不能正常工作<br />service httpd restart</p>
Then visit http://198.xxx.xxx.xxx/phpinfo.php in the browser to see if PHP is working normally.
If the page can display server-related environment information normally, it means that the LAMP environment is working normally.
Install vsftpd
To securely upload files to the server or download files from the server, the easiest way is to use FTP. Here we choose the very popular "Very Secure FTPD" under Linux, that is, very secure FTP:
yum install vsftpd
After installation, you still need to perform some simple configuration:
#编辑 vsftpd 配置文件 vi /etc/vsftpd/vsftpd.conf ... #不允许匿名登陆 anonymous_enable=NO #本地账户可以登陆 local_enable=YES #可以写入 write_enable=YES #所有用户只能访问其 home 目录 chroot_local_user=YES ... #重启 vsftpd 以上设置才能生效 service vsftpd restart
How to access the server using FTP protocol? Here we recommend the FTP client tool FileZilla, which is available in Windows, Linux and Mac OS versions.
Login to vsftpd usually uses the Linux user area to log in, but the root user is not allowed to log in, so you need to create a new Linux user:
#添加用户 lichao adduser lichao #为 lichao 设置密码 passwd lichao #如果出于安全考虑,这个用户你只想它能登陆 vsftpd, #而不能以 ssh 方式登陆服务器,可以禁止其 ssh 登陆 usermod -s /sbin/nologin lichao
At this point, you can use any FTP tool such as FileZilla to log in to vsftpd with the user lichao and the corresponding password. The default directory is /home/lichao
Set up Apache, MySQL and vsftpd services to start at boot
The command to set them up at startup is as follows:
chkconfig httpd on chkconfig mysqld on chkconfig vsftpd on
PHP will be started with Apache.
At this point, a basically complete dynamic web server, database server, and FTP server are installed.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

The Installation, Configuration and Optimization Guide for HDFS File System under CentOS System This article will guide you how to install, configure and optimize Hadoop Distributed File System (HDFS) on CentOS System. HDFS installation and configuration Java environment installation: First, make sure that the appropriate Java environment is installed. Edit /etc/profile file, add the following, and replace /usr/lib/java-1.8.0/jdk1.8.0_144 with your actual Java installation path: exportJAVA_HOME=/usr/lib/java-1.8.0/jdk1.8.0_144exportPATH=$J

CentOS hard disk mount is divided into the following steps: determine the hard disk device name (/dev/sdX); create a mount point (it is recommended to use /mnt/newdisk); execute the mount command (mount /dev/sdX1 /mnt/newdisk); edit the /etc/fstab file to add a permanent mount configuration; use the umount command to uninstall the device to ensure that no process uses the device.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node
