{"id":1917,"date":"2026-09-12T13:22:44","date_gmt":"2026-09-12T10:22:44","guid":{"rendered":"https:\/\/narhost.com\/destek\/nodejs-pm2-kurulumu-vps\/"},"modified":"2026-09-12T13:22:44","modified_gmt":"2026-09-12T10:22:44","slug":"nodejs-pm2-kurulumu-vps","status":"publish","type":"post","link":"https:\/\/narhost.com\/destek\/nodejs-pm2-kurulumu-vps\/","title":{"rendered":"Node.js Kurulumu ve PM2 ile Process Y\u00f6netimi (VPS)"},"content":{"rendered":"<p class=\"kb-dogrulama\">Son do\u011frulama: Eyl\u00fcl 2026 \u00b7 Ubuntu 24.04 test sunucusunda denendi<\/p>\n<div id=\"hizli-cozum\" class=\"ai-box ai-box--cozum\">\n<p class=\"ai-box-title\">H\u0131zl\u0131 \u00e7\u00f6z\u00fcm<\/p>\n<p><strong>Node.js PM2 kurulumu<\/strong> Ubuntu VPS&#8217;te \u00fc\u00e7 ad\u0131mda tamamlan\u0131r: NodeSource deposundan Node.js&#8217;i kurun, <code>npm install -g pm2<\/code> ile PM2&#8217;yi ekleyin, uygulaman\u0131z\u0131 <code>pm2 start app.js --name uygulama<\/code> komutuyla arka planda ba\u015flat\u0131n. PM2, uygulama \u00e7\u00f6kerse otomatik yeniden ba\u015flat\u0131r ve sunucu yeniden ba\u015flasa bile ayakta kalmas\u0131n\u0131 sa\u011flar.<\/p>\n<ol>\n<li>Node.js&#8217;i kurun: NodeSource kurulum beti\u011fi + <code>apt-get install nodejs<\/code><\/li>\n<li>PM2&#8217;yi kurun: <code>npm install -g pm2<\/code><\/li>\n<li>Uygulamay\u0131 ba\u015flat\u0131n: <code>pm2 start app.js --name uygulama<\/code><\/li>\n<li>Durumu g\u00f6r\u00fcn: <code>pm2 list<\/code><\/li>\n<\/ol>\n<\/div>\n<table class=\"kb-uyg\">\n<tr>\n<th>Panel<\/th>\n<td>Yok (SSH \/ terminal)<\/td>\n<\/tr>\n<tr>\n<th>Sistem<\/th>\n<td>Ubuntu 22.04\/24.04 (VPS\/VDS)<\/td>\n<\/tr>\n<tr>\n<th>Yetki<\/th>\n<td>root ya da sudo<\/td>\n<\/tr>\n<tr>\n<th>Narhost \u00fcr\u00fcn\u00fc<\/th>\n<td><a href=\"https:\/\/narhost.com\/vps-sunucu\" title=\"VPS Sunucu - Narhost\">VPS Sunucu<\/a>, VDS Sunucu<\/td>\n<\/tr>\n<\/table>\n<div class=\"kb-once\">\n<p class=\"label\">Ba\u015flamadan \u00f6nce<\/p>\n<ul>\n<li>Sunucunuza root ya da sudo yetkili bir kullan\u0131c\u0131yla SSH ile ba\u011flanabiliyor olmal\u0131s\u0131n\u0131z; ilk kez ba\u011flan\u0131yorsan\u0131z \u00f6nce <a href=\"https:\/\/narhost.com\/destek\/vps-vds-ilk-kurulum-rehberi\/\" title=\"VPS VDS Sunucu \u0130lk Kurulum Rehberi - Narhost Destek\">VPS\/VDS ilk kurulum rehberini<\/a> tamamlay\u0131n.<\/li>\n<li>Uygulaman\u0131z\u0131n kaynak kodu sunucuda haz\u0131r olmal\u0131 (Git ile klonlanm\u0131\u015f ya da FTP\/SFTP ile y\u00fcklenmi\u015f).<\/li>\n<li>Uygulaman\u0131n dinleyece\u011fi port, g\u00fcvenlik duvar\u0131nda ya da bir ters proxy arkas\u0131nda planlanm\u0131\u015f olmal\u0131.<\/li>\n<li>Sunucuda daha \u00f6nce farkl\u0131 bir Node.js s\u00fcr\u00fcm\u00fc kuruluysa \u00e7ak\u0131\u015fmay\u0131 \u00f6nlemek i\u00e7in \u00f6nce onu kald\u0131r\u0131n.<\/li>\n<\/ul>\n<\/div>\n<h2>Node.js PM2 kurulumu ne i\u015fe yarar, ne zaman gerekir<\/h2>\n<p>Narhost VPS ve VDS \u00fcr\u00fcnleri y\u00f6netimsizdir; i\u015fletim sistemi haz\u0131r gelir, uygulama \u00e7al\u0131\u015ft\u0131rma ortam\u0131n\u0131 sunucunuzda siz kurars\u0131n\u0131z. Bir Node.js uygulamas\u0131n\u0131 (API, ger\u00e7ek zamanl\u0131 servis, k\u00fc\u00e7\u00fck bir web uygulamas\u0131) terminalden <code>node app.js<\/code> ile ba\u015flat\u0131rsan\u0131z, SSH oturumunu kapatt\u0131\u011f\u0131n\u0131z an uygulama da durur ve bir hata ald\u0131\u011f\u0131nda kendini yeniden ba\u015flatmaz. PM2, Node.js i\u00e7in tasarlanm\u0131\u015f bir process y\u00f6neticisidir; uygulamay\u0131 arka planda daemon olarak tutar, \u00e7\u00f6kme durumunda otomatik yeniden ba\u015flat\u0131r ve tek komutla birden fazla kopyas\u0131n\u0131 (cluster modu) \u00e7al\u0131\u015ft\u0131rabilir.<\/p>\n<p>Node.js PM2 kurulumu bu y\u00fczden tek ba\u015f\u0131na bir &#8220;kurulum&#8221; de\u011fil, uygulaman\u0131z\u0131 \u00fcretim ortam\u0131nda g\u00fcvenilir \u00e7al\u0131\u015ft\u0131rman\u0131n standart yoludur; PM2 olmadan \u00e7al\u0131\u015fan bir Node.js uygulamas\u0131, sunucu yeniden ba\u015flad\u0131\u011f\u0131nda ya da kod bir istisna f\u0131rlatt\u0131\u011f\u0131nda sessizce durur. PM2&#8217;nin s\u00fcre\u00e7 y\u00f6netimi, log takibi ve cluster modu <a href=\"https:\/\/pm2.keymetrics.io\/docs\/usage\/quick-start\/\" title=\"PM2 resmi h\u0131zl\u0131 ba\u015flang\u0131\u00e7 dok\u00fcmantasyonu\" target=\"_blank\" rel=\"noopener\">PM2&#8217;nin resmi belgesinde<\/a> ayr\u0131nt\u0131l\u0131 anlat\u0131l\u0131r.<\/p>\n<figure class=\"nh-sema\"><img src=\"https:\/\/narhost.com\/destek\/wp-content\/uploads\/2026\/09\/nodejs-pm2-kurulumu-vps-sema-narhost.webp\" alt=\"Node.js PM2 kurulumu ak\u0131\u015f \u015femas\u0131 \u2014 NodeSource ile Node.js kurma, PM2 ekleme, uygulamay\u0131 ba\u015flatma ve otomatik a\u00e7\u0131l\u0131\u015f\" width=\"1200\" height=\"500\" loading=\"lazy\" decoding=\"async\"><figcaption>Node.js&#x27;ten \u00fcretime d\u00f6rt ad\u0131m: depoyu ekle, Node.js&#x27;i kur, PM2 ile ba\u015flat, otomatik a\u00e7\u0131l\u0131\u015f\u0131 kaydet.<\/figcaption><\/figure>\n<h2>Node.js PM2 kurulumu ad\u0131m ad\u0131m<\/h2>\n<ol class=\"kb-adimlar\">\n<li><strong>NodeSource deposunu ekleyin.<\/strong> Ubuntu&#8217;nun kendi deposu genelde eski bir Node.js s\u00fcr\u00fcm\u00fc ta\u015f\u0131r; g\u00fcncel bir LTS s\u00fcr\u00fcm\u00fc i\u00e7in NodeSource kurulum beti\u011fini \u00e7al\u0131\u015ft\u0131r\u0131n.\n<pre><code class=\"language-bash\">curl -fsSL https:\/\/deb.nodesource.com\/setup_lts.x -o \/tmp\/nodesource_setup.shbash \/tmp\/nodesource_setup.sh<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: <code>Repository configured successfully.<\/code> sat\u0131r\u0131 ve &#8220;To install Node.js, run: apt install nodejs -y&#8221; mesaj\u0131. Hangi s\u00fcr\u00fcm\u00fcn g\u00fcncel LTS oldu\u011funu <a href=\"https:\/\/nodejs.org\/en\/about\/previous-releases\" title=\"Node.js resmi s\u00fcr\u00fcm takvimi\" target=\"_blank\" rel=\"noopener\">Node.js&#8217;in resmi s\u00fcr\u00fcm takviminden<\/a> kontrol edebilirsiniz.<\/p>\n<\/li>\n<li><strong>Node.js&#8217;i kurun.<\/strong>\n<pre><code class=\"language-bash\">apt-get install -y nodejs<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: kurulum biter, <code>node -v<\/code> test sunucusunda <code>v24.21.0<\/code> d\u00f6nd\u00fcrd\u00fc (LTS s\u00fcr\u00fcm numaras\u0131 zamanla de\u011fi\u015fir).<\/p>\n<\/li>\n<li><strong>PM2&#8217;yi npm ile global kurun.<\/strong>\n<pre><code class=\"language-bash\">npm install -g pm2<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: <code>added 77 packages<\/code> benzeri bir \u00f6zet; <code>pm2 --version<\/code> s\u00fcr\u00fcm numaras\u0131n\u0131 g\u00f6sterir (test sunucusunda <code>7.0.4<\/code>).<\/p>\n<\/li>\n<li><strong>Uygulamay\u0131 PM2 ile ba\u015flat\u0131n.<\/strong> Uygulama klas\u00f6r\u00fcn\u00fcze girip giri\u015f dosyan\u0131z\u0131 PM2&#8217;ye verin.\n<pre><code class=\"language-bash\">cd \/yol\/uygulamapm2 start app.js --name uygulama<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: bir tablo \u00e7\u0131kar, <code>status<\/code> s\u00fctununda <code>online<\/code> yazar. Test sunucusunda \u00f6rnek bir uygulama ayn\u0131 komutla saniyeler i\u00e7inde <code>online<\/code> durumuna ge\u00e7ti ve <code>curl<\/code> ile iste\u011fe yan\u0131t verdi.<\/p>\n<\/li>\n<li><strong>Sunucu yeniden ba\u015flad\u0131\u011f\u0131nda otomatik a\u00e7\u0131lmas\u0131n\u0131 sa\u011flay\u0131n.<\/strong>\n<pre><code class=\"language-bash\">pm2 startuppm2 save<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: <code>pm2 startup<\/code> bir <code>systemctl<\/code> komutu \u00f6nerir; o komutu \u00e7al\u0131\u015ft\u0131r\u0131p ard\u0131ndan <code>pm2 save<\/code> ile mevcut s\u00fcre\u00e7 listesini kaydedersiniz.<\/p>\n<\/li>\n<\/ol>\n<div class=\"warn-box\">\n<p class=\"label\">Dikkat<\/p>\n<p>PM2&#8217;yi <code>root<\/code> kullan\u0131c\u0131s\u0131yla kurup <code>pm2 startup<\/code> \u00e7al\u0131\u015ft\u0131rd\u0131ysan\u0131z otomatik a\u00e7\u0131l\u0131\u015f root&#8217;a ba\u011flan\u0131r. Uygulamay\u0131 ayr\u0131 bir kullan\u0131c\u0131yla \u00e7al\u0131\u015ft\u0131rmak istiyorsan\u0131z <code>pm2 startup<\/code> komutunu o kullan\u0131c\u0131 alt\u0131nda tekrar \u00e7al\u0131\u015ft\u0131r\u0131n.<\/p>\n<\/div>\n<h2>Do\u011frulama<\/h2>\n<div class=\"success-box\">\n<p class=\"label\">Sonu\u00e7<\/p>\n<p><code>pm2 list<\/code> komutunda uygulaman\u0131z\u0131n <code>status<\/code> s\u00fctunu <code>online<\/code> g\u00f6r\u00fcn\u00fcyorsa ve <code>curl http:\/\/127.0.0.1:PORT<\/code> ile beklenen yan\u0131t\u0131 al\u0131yorsan\u0131z kurulum tamamlanm\u0131\u015ft\u0131r. Test sunucusunda \u00f6rnek bir HTTP uygulamas\u0131 bu \u015fekilde do\u011fruland\u0131; <code>pm2 show uygulama<\/code> komutu \u00e7al\u0131\u015fma s\u00fcresini, log dosyas\u0131 yollar\u0131n\u0131 ve yeniden ba\u015flama say\u0131s\u0131n\u0131 ayr\u0131ca g\u00f6sterir.<\/p>\n<\/div>\n<h2>H\u00e2l\u00e2 \u00e7\u00f6z\u00fclmediyse<\/h2>\n<ul>\n<li><strong>Uygulama &#8220;online&#8221; g\u00f6r\u00fcn\u00fcyor ama yan\u0131t vermiyor.<\/strong> Uygulaman\u0131n <code>0.0.0.0<\/code> yerine <code>127.0.0.1<\/code>&#8216;e ba\u011fl\u0131 dinledi\u011fini kontrol edin; d\u0131\u015far\u0131dan eri\u015fim gerekiyorsa uygulaman\u0131n \u00f6n\u00fcne bir <a href=\"https:\/\/narhost.com\/destek\/nginx-kurulumu\/\" title=\"Nginx kurulumu - Narhost Destek\">Nginx<\/a> ters proxy koyun.<\/li>\n<li><strong>&#8220;npm: command not found&#8221; hatas\u0131.<\/strong> NodeSource beti\u011fi \u00e7al\u0131\u015fmam\u0131\u015f olabilir; ikinci ad\u0131m\u0131 tekrarlay\u0131n ve <code>node -v<\/code> ile kurulumu do\u011frulay\u0131n.<\/li>\n<li><strong>Uygulamay\u0131 konteynerde \u00e7al\u0131\u015ft\u0131rmak istiyorsan\u0131z<\/strong> PM2 yerine <a href=\"https:\/\/narhost.com\/destek\/ubuntu-docker-kurulumu\/\" title=\"Ubuntu Docker kurulumu - Narhost Destek\">Docker<\/a> ile izole bir s\u00fcre\u00e7 y\u00f6netimi de tercih edebilirsiniz; ikisi farkl\u0131 yakla\u015f\u0131mlard\u0131r, ayn\u0131 sunucuda ikisine de gerek yoktur.<\/li>\n<\/ul>\n<div class=\"cta-box\">\n<p class=\"label\">Narhost deste\u011fi<\/p>\n<p>Kurulum s\u0131ras\u0131nda tak\u0131l\u0131rsan\u0131z destek talebinize sunucunuzun i\u015fletim sistemi s\u00fcr\u00fcm\u00fcn\u00fc, <code>node -v<\/code> ve <code>pm2 --version<\/code> \u00e7\u0131kt\u0131s\u0131n\u0131 ve ald\u0131\u011f\u0131n\u0131z tam hata mesaj\u0131n\u0131 ekleyin.<\/p>\n<p><a class=\"cta-btn\" href=\"https:\/\/narhost.com\/submitticket.php\" title=\"Narhost destek talebi a\u00e7\">Destek talebi a\u00e7<\/a><\/div>\n<div class=\"kb-ilgili\">\n<p class=\"label\">Sonraki ad\u0131mlar<\/p>\n<ul>\n<li><a href=\"https:\/\/narhost.com\/destek\/vps-vds-ilk-kurulum-rehberi\/\" title=\"VPS VDS Sunucu \u0130lk Kurulum Rehberi - Narhost Destek\">VPS\/VDS Sunucu \u0130lk Kurulum Rehberi<\/a><\/li>\n<li><a href=\"https:\/\/narhost.com\/destek\/nginx-kurulumu\/\" title=\"Nginx kurulumu - Narhost Destek\">Nginx Kurulumu<\/a><\/li>\n<li><a href=\"https:\/\/narhost.com\/destek\/top-htop-ile-kaynak-izleme\/\" title=\"top htop ile kaynak izleme - Narhost Destek\">top\/htop ile Kaynak \u0130zleme<\/a><\/li>\n<\/ul>\n<\/div>\n<div class=\"kb-faq\">\n<h2>S\u0131k\u00e7a sorulan sorular<\/h2>\n<h3>Node.js PM2 kurulumu i\u00e7in Docker&#8217;a gerek var m\u0131?<\/h3>\n<p>Hay\u0131r, ikisi ayr\u0131 yakla\u015f\u0131md\u0131r. PM2 tek sunucuda s\u00fcre\u00e7 y\u00f6netimi sa\u011flar; Docker&#8217;\u0131 yaln\u0131zca uygulaman\u0131z\u0131 izole bir konteynerde \u00e7al\u0131\u015ft\u0131rmak istiyorsan\u0131z tercih edersiniz.<\/p>\n<h3>PM2 ka\u00e7 uygulamay\u0131 ayn\u0131 anda y\u00f6netebilir?<\/h3>\n<p>Sunucu kayna\u011f\u0131n\u0131z yetti\u011fi s\u00fcrece s\u0131n\u0131r yoktur; her uygulamay\u0131 <code>pm2 start<\/code> ile ayr\u0131 bir isimle ekler, <code>pm2 list<\/code> ile hepsini tek ekrandan izlersiniz.<\/p>\n<h3>Sunucu yeniden ba\u015flarsa uygulamam otomatik a\u00e7\u0131l\u0131r m\u0131?<\/h3>\n<p>Yaln\u0131zca <code>pm2 startup<\/code> ve <code>pm2 save<\/code> komutlar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rd\u0131ysan\u0131z. Bu iki komut olmadan PM2 s\u00fcre\u00e7leri yeniden ba\u015flatmada kal\u0131c\u0131 olmaz.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Node.js PM2 kurulumu: NodeSource deposundan Node.js kurma, npm ile PM2 ekleme, uygulamay\u0131 pm2 start ile ba\u015flatma, sunucu yeniden ba\u015flad\u0131\u011f\u0131nda otomatik a\u00e7\u0131l\u0131\u015f ve do\u011frulama ad\u0131mlar\u0131.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13],"tags":[249,248],"class_list":["post-1917","post","type-post","status-publish","format-standard","hentry","category-vds-server","category-vps-server","tag-pm2","tag-nodejs"],"meta_box":[],"_links":{"self":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts\/1917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/comments?post=1917"}],"version-history":[{"count":0,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts\/1917\/revisions"}],"wp:attachment":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/media?parent=1917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/categories?post=1917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/tags?post=1917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}