[Ubuntu] XAMPP 리눅스 부팅시 자동실행 > Linux/Tech

본문 바로가기

사이트 내 전체검색

Linux/Tech

[Ubuntu] XAMPP 리눅스 부팅시 자동실행

작성일 21-04-18 11:18

페이지 정보

작성자sbLAB 조회 5,807회 댓글 0건

본문

□ XAMPP가 PC리부트시 자동시작되도록 등록 -------  [검증완료]

# cd /etc/systemd/system 

[etc/systemd/system 아래에 xampp.service 파일생성, 아래 녹색내용 붙혀넣기]
#nano xampp.service    
---------내용시작---------------
[Unit]
Description=XAMPP

[Service]
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
Type=forking

[Install]
WantedBy=multi-user.target
---------내용끝---------------

[자동시작 서비스 OS에 등록]
#systemctl enable xampp.service

[xampp 서비스 작동상태 확인]
#systemctl status xampp.service
---------------
○ xampp.service - XAMPP
     Loaded: loaded (/etc/systemd/system/xampp.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
root@sbpc:/
     ....
     908 "proftpd: (accepting connections)"   
     Dec 17 10:33:02 sbwindpc proftpd[908]: sbpc - ProFTPD 1.3.6 (stable) (built Tue Nov 22 2022 08:14:01 UTC) standalone mode STARTUP    
--------------

위를 보면 Active: inactive (dead) 로 나온다. -> #reboot 를 해주고 리눅스 재시작 
# systemctl status xampp.service 
----------------
● xampp.service - XAMPP
     Loaded: loaded (/etc/systemd/system/xampp.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-12-17 10:33:02 KST; 4min 47s ago
    Process: 647 ExecStart=/opt/lampp/lampp start (code=exited, status=0/SUCCESS)
      Tasks: 41 (limit: 4487)
     Memory: 129.3M
--------------------


--------------- [아래는 우분투 구버전 일때] --------- 미검증 ----


After starting using XAMPP in Ubuntu, there's a common error appeared to the users. That is considered as the failure of starting of Apache web server. We have to stop it and restart it. 

Stop Code - sudo /etc/init.d/apache2 stop
Start Code - sudo /opt/lampp/lampp start 

And the other problem is we have to start the server using a terminal command, whenever we want to use it. Here I'm going to explain a way to get rid of these two problems. If you can make XAMPP to start automatically when you reboot the machine, there you find  the  solution. This is the way to to it. 

[Start below]

1. First, open a terminal and type this command to edit the lampp file located in etc folder. 

       sudo gedit /etc/init.d/lampp

2. A text file will be  opened and type the following commands to add the script to make XAMPP to       be started automatically.

#!/bin/bash
### BEGIN INIT INFO
# Provides: lampp
# Required-Start:    $local_fs $syslog $remote_fs dbus
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start lampp
### END INIT INFO
/opt/lampp/lampp start

3. Save this file and close the file. If terminal is still running, press ctrl + c to terminate it.
    Then type this command.

    sudo chmod +x /etc/init.d/lampp

4. Finally type this command also to update the relevant file.

    sudo update-rc.d lampp defaults

5. Now restart the machine!

Open the XAMPP GUI or type sudo /opt/lampp/lampp start on a  terminal to check whether XAMPP is running or not. There you will see all 3 services are running in the system. That's all....!

Enjoy the power of XAMPP!

댓글목록

등록된 댓글이 없습니다.

Copyright © 소유하신 도메인. All rights reserved.
PC 버전으로 보기