sh VPS服务器 - 设置 - Centos的
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh VPS服务器 - 设置 - Centos的相关的知识,希望对你有一定的参考价值。
// To check the OS of the server.
"cat /etc/os-release" (to check the operating system of the srever and version of it.)
// Enter into the server for the first time.
. Type in the given server IP:104.237.9.126 and server default password.(Opens up the server [root@USTEST ~])
// Change the default 'root' password to a different password.
// can be used to change the password at any point of time by just mentioning the user at the end insterd of root.
. set/reset root password
CMD - "passwd root"
// If needed create different users based on your requirement.
. add new user (e.g: us)
"adduser us"
// after the above step create a password for the above mentioned user.
. set passwd for the new user (ex: us)
"passwd us"
// new users has to be assigned to a group.
. add new user to super privileges group (wheel) (ex: us)
"gpasswd -a us wheel"
// Install firewall to protect your server.
. "yum install firewalld" - (install the firewall)
"systemctl start firewalld" - (start the firewall after installation.)
"systemctl enable firewalld" - (enable the firewall after starting it.)
"systemctl status firewalld" - (check the status of the firewalld.)
// install java in the server.
. install Java
"yum install java-1.8.0-openjdk"
"java -version" - (to get the version of the installed java.)
// set the java path in the environment.
. set JAVA_HOME environment variable
"update-alternatives --config java" - fetch java installation folder path (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java)
"nano .bash_profile" - edit profile file
"export JAVA_HOME=<PATH>/jre/bin/java" - add java path at last in the file
"source .bash_profile" - refresh bash profile file
"echo $JAVA_HOME" - check env var
// install Apache server.
. install and start apache server
"yum install -y httpd" - to install the httpd
"systemctl start httpd" - to start the httpd
"systemctl enable httpd" - to enable the httpd
"systemctl status httpd" - to get the satatus of the httpd.
"systemctl restart httpd" - to get the apache restarted.
. open httpd port
"firewall-cmd --permanent --zone=public --add-service=http"
"firewall-cmd --reload"
. install extended package for enterprise linux
"yum install -y epel-release" - ()
. install sudo
"yum install sudo" - to install sudo users.
// yum is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages from official Red Hat software repositories, as well as other third-party repositories.
. update yum
"yum update" - To update your yum packages.
// install php.
. install php
"yum install -y php"
// install phpmyadmin.
. install phpmyadmin
"yum install -y phpmyadmin"
// c onfigure phpmyadmin in the configuration file.
. edit phpmyadmin configuration file
"nano /etc/httpd/conf.d/phpMyAdmin.conf" - open configuration file
<Directory /usr/share/phpMyAdmin/>
<Directory /usr/share/phpMyAdmin/setup/> - change following lines in these sections
// change following lines in these two above sections.
# Require ip 127.0.0.1
# Require ip ::1 - comment this two line
# Require all granted - add this line
// Wget is a free and open source software package for retrieving files using HTTP, HTTPS, and FTP, the most widely-used Internet protocols.
// to download the files from a perticular link.
. install wget
"yum install wget"
. update repository to include mysql
"wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm" - download the mysql package
"sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm" - add to red hat packages
"yum update" - update yum
. install and start mysql
"sudo yum install mysql-server"
"sudo systemctl start mysqld"
"sudo systemctl status mysqld"
"sudo systemctl restart mysqld" - restart the mysql.
. secure mysql
"mysql_secure_installation" - Follow this link: https://mariadb.com/kb/en/library/mysql_secure_installation/
"sudo systemctl restart mysqld" - restart mysql server.
"systemctl restart httpd" - restart the httpd instance.
. install and start ftp server
"yum install vsftpd"
"systemctl start vsftpd"
"systemctl enable vsftpd"
. edit ftp server conf file
"nano /etc/vsftpd/vsftpd.conf" -Follow this link: https://linuxize.com/post/how-to-setup-ftp-server-with-vsftpd-on-centos-7/
// Reload the firewall.
firewall-cmd --reload
Some useful Links:
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-centos-7
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-centos7
https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-centos-quickstart
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
https://linuxize.com/post/how-to-setup-ftp-server-with-vsftpd-on-centos-7/
https://mariadb.com/kb/en/library/mysql_secure_installation/
以上是关于sh VPS服务器 - 设置 - Centos的的主要内容,如果未能解决你的问题,请参考以下文章