Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Judith
Judith

Posted on • Edited on

     

Add a LAMP Stack to a server with Centos OS

Log in as root

sshroot@your.ip.address.here

add a new user with sudo privileges

[root@myserver ~]# adduser admin
[root@myserver ~]# passwd admin
Changing password for user admin.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@myserver ~]# usermod -aG wheel admin

change from root to new user

[root@myserver ~]# su - admin
.
[admin@myserver ~]$ sudo ls -la /root

[sudo] password for admin:

update Centos

[admin@myserver ~]$ sudo yum update

add apache

[admin@myserver ~]$ sudo yum install httpd

start apache

[admin@myserver ~]$ sudo systemctl start httpd.service

add mariadb

[admin@myserver ~]$ sudo yum install mariadb-server mariadb

start mariadb

[admin@myserver ~]$ sudo systemctl start mariadb

secure mariadb

[admin@myserver ~]$ sudo mysql_secure_installation

system will ask these questions. answer with y

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

Remove anonymous users? [Y/n] y
... Success!

Disallow root login remotely? [Y/n] y
... Success!

Remove test database and access to it? [Y/n] y

  • Dropping test database...... Success!
  • Removing privileges on test database...... Success!

Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...

let system start maria db

[admin@myserver ~]$ sudo systemctl enable mariadb.service

add php and mysql

[admin@myserver ~]$ sudo yum install php php-mysql

restart apache

[admin@myserver ~]$ sudo systemctl restart httpd.service

install nano editor

[admin@myserver ~]$ sudo yum install nano

add php info file so you can check your installation

[admin@myserver ~]$ sudo nano /var/www/html/info.php

info page is athttp://youripaddress/info.php

that's it. go to your ip address and you should have the apache start page

Top comments(2)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
lmuzquiz profile image
lmuzquiz
A web developer who combines branding, user interface design , web development & digital marketing, to improve sales. Proud that all of his clients came from mouth to mouth recommendation.
  • Location
    Mexico
  • Joined
• Edited on• Edited

You might want to add the word "Centos" on the title to clarify it's a Centos server, . Instructions may vary if the server is Ubuntu, Debian, not to mention any other kind of server which is not Linux

CollapseExpand
 
jrohatiner profile image
Judith
frontend software engineer. mental adventurist
  • Email
  • Location
    miami beach/new york
  • Education
    Masters Degree Systems
  • Work
    Senior Frontend Software Engineer at AChickAndAClick
  • Joined

Thanks for pointing that out. I will definitely do that!
Namaste!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

frontend software engineer. mental adventurist
  • Location
    miami beach/new york
  • Education
    Masters Degree Systems
  • Work
    Senior Frontend Software Engineer at AChickAndAClick
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp