How to update/install glibc-2.14 on centos 6.x

Update reason:

 

check installed glibc version:

 

I have tried update glibc like below:

but didn’t work, so tried the solution like below steps:

  • download glibc-2.14.tar.gz
  • extract the download files and build, install in /opt/glibc-2.14:

     
  • update glibc symbolic links:

     

If you want restore glibc symbolic links :

 

Bookmark/Favorites

How to find files created on a specific date?

1.How to find files modified / created /  accessed  on a specific date

Example 1: find files modified on the 10th of December

Example 2: find files created on the 10th of December

Example 3: find files accessed on the 10th of December

 

2.Then how to use find to delete the files found above

 

 

Bookmark/Favorites

How to install Node.js and NPM on Centos?

Before installation, please check your server operation system, this time we will install node.js on centos 6.7:

Then you can check which yum repository you should use, please read Node.js Binary Distributions to find the yum repository

Step 1. Add node.js yum repository

In my case, I chosed NodeJS 8.x on CentOS 6

Step 2: Install node.js and NPM

After the command complete, node.js and npm are both installed completely (also include some other dependent packages).

 

Step 3: Verify versions

Now we can check the node.js and npm version like below:

 

Bookmark/Favorites

How to check changes before pulling from remote git repository

Check changes before pulling from remote git repository steps below:
  1. fetch the changes from the remote
  2. show commit logs of changes
  3. show diffs of changes
  4. apply the changes by merge..

     
Difference between Git Pull vs Git Fetch:

Git pull will download and merge latest changes from the remote repository automatically. You don’t have chance to review the changes and conflicts.

Git fetch will only download lastest changes but won’t merge. You can use git diff to review the changes and conflicts, then use git merge to merge the changes.

Bookmark/Favorites

How to use iptables to defend against reflection DDOS attack on Centos

Usually use iptables to drop the UDP fragmented packets, below is the iptables config example:

vi /etc/sysconfig/iptables

 

Reference:

HOW TO DEFEND AGAINST AMPLIFIED REFLECTION DDOS ATTACKS

DDoS attacks – an explanation of amplified reflective UDP-based attacks

Bookmark/Favorites

AWS reinvent 2018 Slides index


Let’s take a look at AWS reinvent 2018 from these slides

You also can check more slide from AWS on slidesshare.net

Bookmark/Favorites

How to connect Amazon EC2 Linux Instance if you lose Private Key

  1. From AWS EC2 Management Console, click Instances, select the original instance (that you lose the private key)
  2. Memo the detail information of the original instance:
    • the instance ID (i-xxxxxxxx), AMI ID (ami-xxxxxxxx), and Availability Zone of the original instance from the details pane.
    • volume ID in the EBS ID field (vol-xxxxxxxx) under Block devices  the details pane.
    • [EC2-Classic] If the original instance has an associated Elastic IP address, write down the Elastic IP address shown under Elastic IP in the details pane.
  3. Select the original instance to click stop.
  4. Launch a new instance with same config as  the original instance. You can tag the new instance as Name=Temporary and create a new key pair, download it.
  5. Click Volumes in the navigation pane, select the root device volume for the original instance. Click Detach Volume to detach the volum. Wait for the state of the volume to become available. (You might need to click the Refresh icon.)
  6. Atach the original instance’s root volume to the new instance and specify the device name (for example, /dev/sdf ) .
  7. Use PuTTY to connect the new instance via SSH.
  8. Mount the root device volume for the original instance to the new instance.
    • Use the lsblk command to determine if the volume is partitioned.

      In the above example, /dev/xvda and /dev/xvdf are partitioned volumes, and /dev/xvdg is not. If your volume is partitioned, you mount the partition (/dev/xvdf1) instead of the raw device (/dev/xvdf) in the next steps.
    • Create a temporary directory to mount the volume.

       
    • Mount the volume (or partition) at the temporary mount point, using the volume name or device name you identified earlier.
  9. Use the new instance’s authorized_keys to update the original instance‘s authorized_keys

    If copy failed, please modify the file permission.
  10. Unmount the /mnt/tempvol

    So you can reattach it to the original instance again
  11. From the Amazon EC2 Management Console, select the original instance’s volume, click Actions, and then click Detach Volume. Wait for the state of the volume to become available. (You might need to click the Refresh icon.)
  12. Then select original instance’s volume, click Actions and click Attach Volume. Select the original instance ID,  specify the device name that you memoed (for example, /dev/xvda), and then click Yes, Attach.
  13. Select the original instance to start. After the instance’s state becomes running , you can connect to it using the private key file for your new key pair.
Bookmark/Favorites

How to fix: Mysql ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

The error means the logined user’s password was expired, you excute the sql to confirm:

 

To resolve the error , you can reset the password:

 

If you got error,  you also can drop the user and create it again.

Bookmark/Favorites

Tutorial: How to install wordpress on AWS EC2 t2.micro instance ? Charpter-1

Charpter-1: How to install AWS EC2 t2.micro instance

Before installing wordpress on AWS EC2 t2.micro instance (server), we have to prepair an AWS EC2 instance.

In this article I will introduce how to install a free tier AWS EC2 t2.micro instance.

1. Choose an Amazon Machine Image (AMI)
Step1 of installing AWS EC2 t2.micro
Step1 of installing AWS EC2 t2.micro

We selected “Amazon Linux AMI 2014.09.2 (HVM) – ami” to install.

PS: There is another AIM “Amazon Linux AMI 2014.09.2 (PV) – ami“. PV type AMI has smaller memory and lower  network performance than HVM type in free tier.

HMV vs PV AMI
HMV vs PV AMI
2. Choose an Instance Type
Step2 of installing AWS EC2 t2.micro
Step2 of installing AWS EC2 t2.micro

Only t2.micro type is available for free tier.

3. Configure Instance Details
Step 3 Configure Instance Details
Step 3 Configure Instance Details

Use the default configure, then click “Next Add Storage”.

4. Add Storage
Step 4  Add Storage
Step 4 Add Storage

Free tier eligible customers can get up to 30 GB of EBS General Purpose (SSD) or Magnetic storage.

5. Tag Instance
Step 5 Tag Instance
Step 5 Tag Instance

You could define a tag with key = Name and value = Webserver as you wish.

6. Configure Security Group
Step 6 Configure Security Group
Step 6 Configure Security Group

In order to allow anyone access your website, please add HTTP rule as below

Add HTTP Rule
Add HTTP Rule
7. Review Instance Launch
Step 7 Review Instance Launch
Step 7 Review Instance Launch

If no problem, click “Launch

Create a new key pair
Create a new key pair

Input a key pair name as you wish, then click “Download Key Pair” to download a pem file.

After downloading the pem file successfully, the button “Launch Instances” can be clicked now.

Launch Status
Launch Status

Now, we have already got a server ready to install wordpress.

Next: Installing a LAMP Web Server on Amazon Linux

 

Bookmark/Favorites