Navigation

    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. huericw
    huericw

    huericw

    @huericw

    0
    Reputation
    3
    Posts
    4
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    huericw Follow

    Best posts made by huericw

    This user hasn't posted anything yet.

    Latest posts made by huericw

    How to Install Wordpress on CentOS7

    Introduction

    WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. WordPress is used by more than 40.5% of the top 10 million websites as of March 2021, WordPress is one of the most popular blog-publishing and content management system solutions in use.

    Prerequisites:

    • You have already deploy a Cybree Instance with CentOS 7 image.
    • You have already completed the "How to install LAMP on Centos 7 tutorial”, and installed LAMP (Linux, Apache, MySQL, PHP) on your server
    • You have your root mysql password so you can log into mysql as root.

    Step 1: Create a Database

    1. After you login to your Cybree instance, run the following command to log in as root user
    mysql -u root -p
    
    1. You will be prompted for the password you set earlier as root when you installed MySQL. If you do not have your root password, you will have to reset it.
       
      0933d891-3485-4cae-83ac-402b7d12576e-image.png

    2. Once logged in, we can create a database with the following command. You can call it whatever you would like, but for this article, we are calling it WordPress. Please note that every mysql command will require a ; (colon) at the end of every statement

    CREATE DATABASE wordpress;
    
    1. Once our database is created, you need to create a user for that database. Once again I am using a very simple username, and password so feel free to make yours more secure. Do remember your username and password as we will need it later in this article. Type the following command.
    CREATE USER adminuser@localhost IDENTIFIED BY 'password';
    
    1. Now we need to give that user permissions to access the database. We can add those permissions with the following command. If you use your own database name, user, and password, you should also replace it in the command. Also note that the password is contained in single quotes followed by a colon;
    GRANT ALL PRIVILEGES ON wordpress.* TO adminuser@localhost IDENTIFIED BY 'password';
    
    1. Now we want to flush MySQL so that it is made aware of those changes.
    FLUSH PRIVILEGES;
    
    1. and finally, exit MySQL
    Exit
    

    Step 2) Install WordPress

    1. Download the latest wordpress file
    cd ~ 
    
    wget http://wordpress.org/latest.tar.gz
    
    1. Now, let’s  unzip that tar file
    tar -xzvf latest.tar.gz
    
    1. That should create a file named WordPress in our home directory. Next, we want to move that file and its contents to our public_html folder, so it can serve up the content for our website. We want to keep the same file permission, so we use the following rsync command.
    sudo rsync -avP ~/wordpress/ /var/www/html/
    
    1. For WordPress to be able to upload files, we need to create an uploads directory. Go ahead and use the following:
    mkdir /var/www/html/wp-content/uploads
    
    1. Lastly, update the Apache permissions for new WordPress files
    sudo chown -R apache:apache /var/www/html/*
    

    Step 4) Configuring WordPress

    1. Next, we have to update the wp-config.php file in WordPress for it to connect to the database successfully. So let’s go to the html folder where your WordPress install is located.
    cd /var/www/html
    
    1. Create a wp-config.php file by copying the sample file WordPress has provided.
    cp wp-config-sample.php wp-config.php
    
    1. Now, we need to edit the new wp-config.php file with the correct database information we created in Step 1.  I used vim to make that change, but you can use any editor you are comfortable with.
    sudo nano wp-config.php
    
    1. Next, we need to add info into the following fields of the database, user, and password we created in Step 1.

    Old Settings:

    // ** MySQL settings - You can get this info from your web host ** // 
    
    /** The name of the database for WordPress */ 
    define( 'DB_NAME', 'database_name_here' ); 
    
    /** MySQL database username */ 
    define( 'DB_USER', 'username_here' ); 
    
    /** MySQL database password */ 
    define( 'DB_PASSWORD', 'password_here' );
    

    New Settings:

    // ** MySQL settings - You can get this info from your web host ** // 
    
    /** The name of the database for WordPress */ 
    define( 'DB_NAME', 'wordpress' );
    
     /** MySQL database username */ 
    define( 'DB_USER', 'adminuser' );
    
    /** MySQL database password */ 
    define( 'DB_PASSWORD', 'password' );
    
    1. Once you have made those changes, go ahead and save the file using CTRL+X (to exit) and Y and Enter (to save changes, and close the file).

    Step 5) Setup through wp-admin and verification

    1. Now, let’s verify that your WordPress install is working. You should see something like the following on your server page. Replace server_domain_name_or_IP with your server name or IP.  http://[server_domain_name_or_IP]/wp-admin

    5fef4d1e-d206-41d5-af89-e72586ec093f-image.png

    1. If this is what you see then congrats!!! You have successfully installed WordPress on your Centos server. You can continue with the rest of the Wordpress setup to configure your wordpress blog.
    posted in Tutorials & How To •
    How to Install LAMP stack on CentOS7

    Introduction

    The LAMP stack is a bundle consisting of a Linux operating system, an Apache server, a MySQL (MariaDB) database, and the PHP programming language. Each layer of the stack represents an open-source software required for developing web applications.

    In this tutorial you will learn how to install the LAMP stack on CentOS 7.


    Prerequisites

    • Deploy a Cybree Instance with CentOS 7 image.
    • Connect to your instance via Cybree VNC terminal, or use other terminal (such as Putty SSH) to connect your instance
    • Login to account with sudo or root privileges. The default Centos administrator login name is "root"

    Step 1: Update Package Repository Cache

    1. Before you start building the stack, be sure to update the packages on your CentOS 7 server using the command:
    sudo yum update -y
    
    1. Wait a few minute to download and process until it prompts "Complete!"

    Step 2: Install the Apache Web Server

    The first step of assembling the LAMP stack is to install the Apache web server through CentOS's native package manager, yum.

    1. Install Apache on Centos with:
    sudo yum install httpd
    
    1. Enter "y" when you are prompted to confirm the installation. The output will show the package httpd package was installed as in the image below:

    1d703313-4ff9-45d8-b9b9-d5a63af15d8d-图片.png

    1. Next, start Apache by running the following command:
    sudo systemctl start httpd.service
    
    1. Check whether the service is running by going to your server's public IP address. The browser should display the test CentOS 7 Apache web page:

    dcf20127-c4b3-4101-b228-6f20bc01e99b-图片.png

    1. Finally, set up Apache to start at boot:
    sudo systemctl enable httpd.service
    

    Step 3: Install MySQL (MariaDB) and Create a Database

    To organize and store data for your dynamic website, you need MariaDB. This is an open-source fork of the MySQL database management system. It is a backward compatible and binary drop-in replacement for the original MySQL.

    1. Install MariaDB with the command:
    sudo yum install mariadb-server mariadb
    
    1. When a y/n prompt appears, confirm with y.

    2. Now start MariaDB using the command:

    sudo systemctl start mariadb
    

    Step 4: Run MySQL Security Script

    MariaDB does not have secure settings by default. Therefore, you need to configure settings, test the database, and remove anonymous users.

    1. Begin by typing the command:
    sudo mysql_secure_installation
    
    1. You will be prompted to provide your MariaDB root password (this is not the root password for your server). As you do not have a password yet, pressing Enter allows you to continue configuration.

    2. Next, it will ask you a series of queries. To ensure your database is protected, answer the questions as follows:

    • Set root password? [y/n] Y
    • New password: Type in a password you would like to use
    • Re-enter new password: Retype the password from the previous field
    • Remove anonymous users? [y/n] Y
    • Disallow root login remotely? [y/n] Y
    • Remove test database and access to it? [y/n] Y
    • Reload privilege tables now? [y/n] Y
    1. After answering the questions, the output will display a message that your system is cleaning up, and the installation should now be secure.

    2dc95c60-2887-437b-acea-0d9512947c07-图片.png

    1. Lastly, enable MariaDB to start up when you boot the system:
    sudo systemctl enable mariadb.service
    

    Step 5: Install PHP 5.6

    As a server-side scripting language, PHP is the part of the LAMP grouping that processes the code for showing dynamic content. Once it is connected with the MySQL database, PHP will be retrieving information and processing it for the Apache webserver to display.

    1. First, you must add the Webtatic EL yum repository information corresponding to your CentOS version to yum:
    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    
    1. Install the MySQL extension along with PHP, again using the yum package installer, with the command:
    sudo yum install php56w php56w-mysql
    
    1. Enter "y" when you are prompted to confirm the installation.

    2. To have your Apache webserver start co-working with PHP, restart the server:

    sudo systemctl restart httpd.service 
    

    Step 6: Test PHP Processing

    To locate and serve the website, Apache must save the file to the web root. Apache places its default website in this directory: /var/www/html/

    1. In case nano editor is not installed yet, use this command to install nano
    sudo yum install nano
    
    1. Use a basic PHP script to make an info.php file, with the command:
    sudo nano /var/www/html/info.php
    
    1. This opens a blank text file in which you should copy and paste the following:
    <?php
    phpinfo ();
    ?>
    
    1. Hold CTRL+X (to exit) and Y and Enter (to save changes, and close the file).

    2. In order for the changes to take effect, restart the Apache service with the command:

    sudo systemctl restart httpd.service
    
    1. Check whether PHP is working by visiting the following URL on your browser: http://[ip_address]/info.php

    The [ip_address] should be the public IP address of your Cybree instance. You can look it up on your Cybree console. If PHP is set up correctly you will see this image on the browser:

    c9f7e9c3-1976-4896-b6af-4887d87d18a2-图片.png


    Conclusion

    By following this guide, you learned how to install each layer of the LAMP stack on CentOS 7. Now you are ready to explore all the innovations the LAMP stack makes possible.

    posted in Tutorials & How To •
    RE: Post all your test, first post, welcome message here :)

    This is a test from Eric

    posted in General Discussion •