7 03 2020
Ubuntu에서 apt 없이 톰캣 설치하기
이 글은 우분투, 정확히는 데비안 계열 리눅스에서 apt 없이 톰캣을 설치하는 방법을 정리한 글이다. 레드햇 계열에서 해보지는 않았지만, 어차피 사용자와 그룹 만들고, 압축파일 다운로드 받아서 푸는 정도는 딱히 운영체제를 가리지 않을 것이라고 생각된다. 다만 시스템 서비스로 등록하는 부분은 시스템마다 다르며, 이 글은 우분투에서 등록하고 실행하는 것을 전제로 작성하였다.
이 글은 아래 내용을 참고하여 작성하였다.
전제조건
시스템에 자바는 이미 설치되어 있는 것으로 가정한다. 이 글에서 자바를 설치하는 방법은 설명하지 않는다.
자바가 설치되어 있지 않은 경우에는 이 글을 참고해서 자바부터 설치한다.
톰캣이 설치되는 경로는 /opt/tomcat
으로 가정한다.
1. 톰캣 디렉토리 생성 및 그룹과 사용자 생성
현재 로그인된 계정으로 톰캣을 실행해도 실행에 지장은 없지만, 보안을 생각하면 톰캣이 실행될 사용자의 그룹을 생성해서, 톰캣 실행은 이 계정으로 한정하는 것이 좋겠다.
톰캣이 설치될 디렉토리부터 생성한다.
1 |
$ sudo mkdir -p /opt/tomcat |
톰캣 사용자가 포함될 그룹을 만들고
1 |
$ sudo groupadd tomcat |
톰캣이 구동될 사용자를 생성한다.
1 |
$ sudo useradd tomcat -g tomcat |
만약 톰캣 사용자로 로그인할 필요가 없다고 판단된다면 아래처럼 생성해도 된다.
1 |
$ sudo useradd tomcat -g tomcat -s /bin/false |
2. 톰캣 다운로드 및 설치
톰캣을 다운로드할 디렉토리를 만들고, 톰캣을 다운로드한다. 톰캣 압축파일은 톰캣 홈페이지에서 설치하려는 버전에 맞는 tar.gz 파일을 다운로드하면 된다.
1 2 3 |
$ mkdir ~/tmp $ cd ~/tmp $ curl -O http://mirror.apache-kr.org/tomcat/tomcat-8/v8.5.51/bin/apache-tomcat-8.5.51.tar.gz |
다운로드가 완료되면, tar 파일의 압축을 푼다.
1 |
$ sudo tar zxvf apache-tomcat-*.tar.gz -C /opt/tomcat --strip-components=1 |
3. 권한 설정
톰캣의 압축이 다 풀렸다면, 톰캣 디렉토리의 소유 그룹을 위에서 생성한 tomcat 그룹으로 변경하고
1 |
$ sudo chgrp -R tomcat /opt/tomcat |
디렉토리의 소유자를 변경한다.
1 |
$ sudo chown -R tomcat /opt/tomcat |
또, 환경설정 디렉토리에 tomcat 그룹의 execute 권한을 부여한다.
1 |
$ sudo chmod -R g+r /opt/tomcat/conf |
4. 시스템 서비스로 등록
원래 시스템 서비스로 등록하는 부분은 안쓰려고 했는데, 위 순서대로 진행하고 서비스로 등록하지 않으면 권한이 없어서 실행을 못한다 (…)
(물론 sudo su tomcat
으로 톰캣 사용자로 전환해서 실행한다는 방법이 있기는 함)
여기서는 우분투에서 서비스를 등록하는 것으로 가정한다. 서비스를 등록하는 방법은 현재 실행중인 리눅스 시스템에 따라서 다르므로, 우분투 이외의 리눅스의 경우에는 별도로 검색해보자.
nano나 vi 등 익숙한 편집기를 이용해서, /etc/systemd/system 디렉토리에 tomcat.service 파일을 생성하자. 내용은 아래와 같다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[Unit] Description=Apache Tomcat Web Application Container After=network.target [Service] Type=forking Environment=JAVA_HOME=/opt/java/jdk-11 Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xms1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/top/tomcat/bin/shutdown.sh User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target |
위 내용 중 JAVA_HOME 부분만 자신의 시스템에 맞게 수정해서 기입한다.
파일이 생성되었다면 시스템 서비스를 다시 읽어들이자.
1 |
$ sudo systemctl daemon-reload |
이후에는 아래와 같이 입력해서 톰캣을 실행할 수 있다.
1 |
$ sudo systemctl start tomcat |
톰캣이 정상적으로 실행되었는지, curl을 이용해서 확인해보자.
1 2 3 4 5 6 7 |
$ curl -I localhost:8080 HTTP/1.1 200 Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Sat, 07 Mar 2020 09:16:09 GMT $ |
톰캣을 종료할때는 아래 명령으로 종료하자.
1 |
$ sudo systemctl stop tomcat |
BitcoinInvest.cc combines Bitcoin and Forex trading for maximum financial growth.
I appreciate you sharing this blog post. Thanks again. Cool.
I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.
What i dont understood is in reality how youre now not really a lot more smartlyfavored than you might be now Youre very intelligent You understand therefore significantly in terms of this topic produced me personally believe it from a lot of numerous angles Its like women and men are not interested except it is one thing to accomplish with Woman gaga Your own stuffs outstanding Always care for it up
obviously like your website but you need to test the spelling on quite a few of your posts Several of them are rife with spelling problems and I to find it very troublesome to inform the reality on the other hand Ill certainly come back again
Pretty! This has been a really wonderful post. Many thanks for providing these details.
I just like the helpful information you provide in your articles
Excellent breakdown, I completely agree with the challenges you described. For our projects we started using an AI-driven system called AI link building by OptiLinkAI, and it has simplified the entire process. It’s refreshing to see technology finally making link acquisition smarter, not just faster.
Excellent breakdown, I completely agree with the challenges you described. For our projects we started using an AI-driven system called AI link building by OptiLinkAI, and it has simplified the entire process. It’s refreshing to see technology finally making link acquisition smarter, not just faster.
Your blog is a beacon of light in the often murky waters of online content. Your thoughtful analysis and insightful commentary never fail to leave a lasting impression. Keep up the amazing work!
Your blog is a true gem in the world of online content. I’m continually impressed by the depth of your research and the clarity of your writing. Thank you for sharing your wisdom with us.
Your posts always make me stop 🌈 and think about life differently
Your blog is a breath of fresh air in the often stagnant world of online content. Your thoughtful analysis and insightful commentary never fail to leave a lasting impression. Thank you for sharing your wisdom with us.
Hello my loved one I want to say that this post is amazing great written and include almost all significant infos I would like to look extra posts like this
Its like you read my mind You appear to know so much about this like you wrote the book in it or something I think that you can do with a few pics to drive the message home a little bit but other than that this is fantastic blog A great read Ill certainly be back
Your insights always make me think 🔥 💎 🌈 about things in completely new ways
The passion you have for your topic is contagious.
I appreciate you sharing this blog post. Thanks Again. Cool.
This was beautiful Admin. Thank you for your reflections.
Rainx Drive is the Best Cloud Storage Platform
Nice post. I learn something totally new and challenging on websites
Excellent tips — I implemented a few and saw immediate improvement.
Helpful post — could you also share examples for beginners?
Yazdığınız yazıdaki bilgiler altın değerinde çok teşekkürler bi kenara not aldım.
Great tips! I’ve been using https://pdfpanel.com alongside these methods with good results.
Thanks! PDF splitting is a breeze with https://pdfpanel.com.
Purchase Adderall Online
Solid post — bookmarked and shared. Keep producing content like this!
Your tone is friendly and informative — made for an enjoyable read.
Excellent tips — I implemented a few and saw immediate improvement.
Excellent tips — I implemented a few and saw immediate improvement.
Thank you for such a thorough and thoughtful article.
Please write more about the challenges you mentioned — curious for solutions.
Thanks for the practical tips — they made a real difference for me.
Pretty! This has been a really wonderful post. Many thanks for providing these details.
Pretty! This has been a really wonderful post. Many thanks for providing these details.
I truly appreciate your technique of writing a blog. I added it to my bookmark site list and will
Nice work! I shared this with colleagues who will appreciate it.
This cleared up a lot of uncertainty — I feel more confident now.
Interesting post! The psychology of chance is fascinating, and platforms like boss jili seem to tap into that. Account verification is a smart move for security, ensuring a fair experience for everyone involved – a key element of responsible gaming!
Attractive section of content I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts Anyway I will be subscribing to your augment and even I achievement you access consistently fast
https://wealthpetaccessories.store/products/soft-sided-pet-carrier-bag-portable
I must say this article is extremely well written, insightful, and packed with valuable knowledge that shows the author’s deep expertise on the subject, and I truly appreciate the time and effort that has gone into creating such high-quality content because it is not only helpful but also inspiring for readers like me who are always looking for trustworthy resources online. Keep up the good work and write more. i am a follower.
Good post! We will be linking to this particularly great post on our site. Keep up the great writing
I loved as much as you will receive carried out right here The sketch is attractive your authored material stylish nonetheless you command get got an impatience over that you wish be delivering the following unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike
Yayınladığı etkileyici paylaşımlar, derin anlayış kazandıranve hemen uygulanabilir.
Escort Dating for Click: https://helboy.yenibayanlar.com/kategori/antalya-escort/konyaalti-escort/
Escort Dating for Click: https://helboy.yenibayanlar.com/kategori/izmir-escort/karsiyaka-escort/
Thanks for authentic sharing