{"id":3366,"date":"2025-12-24T15:54:15","date_gmt":"2025-12-24T06:54:15","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=3366"},"modified":"2026-01-07T10:36:12","modified_gmt":"2026-01-07T01:36:12","slug":"ocilinuxdocker-express","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2025\/12\/24\/ocilinuxdocker-express\/","title":{"rendered":"[OCI,Linux]\ub3c4\ucee4 + mysql + express \/ Docker + mysql + express(1)"},"content":{"rendered":"\n<p>\ud83d\udc49OCI\ud658\uacbd\uc124\uc815 \/ OCI environment settings<\/p>\n\n\n\n<p>\ud83d\udc49npm init \ud588\uc744\ub54c \ub2e4\uc74c\uacfc \uac19\uc774 npm\uc774 \uc5c6\ub2e4\uba74 npm\uc124\uce58\ud569\ub2c8\ub2e4.<br>If npm is not present when you run npm init, install npm.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ubuntu@app-20251223-1824:~\/dockerApp\/routes$ npm init\nCommand 'npm' not found, but can be installed with:\nsudo apt install npm<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install npm<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49nodejs \ucd5c\uc2e0\ubc84\uc804 \uc124\uce58 \/ Install the latest version of nodejs<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># NVM \uc124\uce58 \uc2a4\ud06c\ub9bd\ud2b8 \uc2e4\ud589 (\uacf5\uc2dd GitHub\uc5d0\uc11c \uac00\uc838\uc634)\n# Run the NVM installation script (from the official GitHub)\ncurl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.40.1\/install.sh | bash\n\n# \uc258 \uc7ac\uc2dc\uc791\ud558\uac70\ub098 \uc124\uc815 \uc801\uc6a9\n# Restart shell or apply settings\nsource ~\/.bashrc  # \ub610\ub294 ~\/.zshrc n\u1ebfu Zsh \uc0ac\uc6a9 \uc911\n# (\ud130\ubbf8\ub110 \uc7ac\uc2dc\uc791\ud574\ub3c4 \ub428)\n\n# \uc124\uce58 \ud655\uc778 \/ Check installation\nnvm --version\n\n# \ucd5c\uc2e0 Current \ubc84\uc804 \uc124\uce58 \/ Install the latest Current version\nnvm install node  # \ud604\uc7ac v25.2.1 \uc124\uce58\ub428\n\n# \ub610\ub294 \ucd5c\uc2e0 LTS \ubc84\uc804 \uc124\uce58 \n# or install the latest LTS version\nnvm install --lts\n\n# \uc0ac\uc6a9 \uc911\uc778 \ubc84\uc804 \ud655\uc778\n# Check the version you are using\nnode -v\nnpm -v<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49mysql \uc124\uce58 \ud558\uae30 \/ Install mysql<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install mysql-server<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f\ub2e4\uc74c\uacfc \uac19\uc740 \uba85\ub839\uc5b4\ub85c mysql\uc2e4\ud589 \uc0c1\ud0dc\ub97c \ud655\uc778 \ud569\ub2c8\ub2e4.<br>Check the mysql execution status with the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service mysql status\n#\ub610\ub294 \/ or\nsudo systemctl status mysql<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f\uadf8\ub7ec\uba74 \ub2e4\uc74c\uacfc \uac19\uc774 active \uba54\uc138\uc9c0\uac00 \ubcf4\uc774\uba74 \uc815\uc0c1 \uc124\uce58\ub41c \uac83\uc785\ub2c8\ub2e4.<br>If you see an active message like this, it means it was installed successfully.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u25cf mysql.service - MySQL Community Server\n     Loaded: loaded (\/usr\/lib\/systemd\/system\/mysql.service; enabled; preset: enabled)\n     Active: active (running) since Wed 2025-12-24 07:05:58 UTC; 1min 42s ago\n    Process: 27273 ExecStartPre=\/usr\/share\/mysql\/mysql-systemd-start pre (code=exited, status=0\/SUCCESS)\n   Main PID: 27287 (mysqld)\n     Status: \"Server is operational\"\n      Tasks: 37 (limit: 14233)\n     Memory: 365.5M (peak: 379.8M)\n        CPU: 806ms\n     CGroup: \/system.slice\/mysql.service\n             \u2514\u250027287 \/usr\/sbin\/mysqld\n\nDec 24 07:05:57 app-20251223-1824 systemd&#91;1]: Starting mysql.service - MySQL Community Server...\nDec 24 07:05:58 app-20251223-1824 systemd&#91;1]: Started mysql.service - MySQL Community Server.<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0fmysql secure installation\uc744 \uc2e4\ud589\ud569\ub2c8\ub2e4.<br>Run mysql secure installation.<\/p>\n\n\n\n<p>\u2714\ufe0f\uc544\ub798 \uc124\uc815\uc744 \ucc38\uc870\ud558\uc138\uc694 \/ See settings below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ubuntu@app-20251223-1824:~\/dockerApp\/routes$ sudo mysql_secure_installation\n\nSecuring the MySQL server deployment.\n\nConnecting to MySQL using a blank password.\n\nVALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No: y\n\nThere are three levels of password validation policy:\n\nLOW    Length &gt;= 8\nMEDIUM Length &gt;= 8, numeric, mixed case, and special characters\nSTRONG Length &gt;= 8, numeric, mixed case, special characters and dictionary                  file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0\n\nSkipping password set for root as authentication with auth_socket is used by default.\nIf you would like to use password authentication instead, this can be done with the \"ALTER_USER\" command.\nSee https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/alter-user.html#alter-user-password-management for more information.\n\nBy default, a MySQL installation has an anonymous user,\nallowing anyone to log into MySQL without having to have\na user account created for them. This is intended only for\ntesting, and to make the installation go a bit smoother.\nYou should remove them before moving into a production\nenvironment.\n\nRemove anonymous users? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\n\nNormally, root should only be allowed to connect from\n'localhost'. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nBy default, MySQL comes with a database named 'test' that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nAll done!<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0fOCI\ubc29\ud654\ubcbd \uc624\ud508 \/ OCI Firewall Open<\/p>\n\n\n\n<p>&#8212; \uc77c\ub2e8 \uc804\uccb4 \uc624\ud508 \uc124\uc815\ud568 \/ First, set the entire open<\/p>\n\n\n\n<p>\u2714\ufe0fiptables\ubc29\ud654\ubcbd \uc624\ud508 \/ Open iptables firewall<\/p>\n\n\n\n<p>\u2b50\uc8fc\uc758:22\ubc88\ud3ec\ud2b8\ub294 \uc808\ub300 \ub9c9\uc9c0\ub9c8\uc138\uc694 \ub2e4\uc2dc \ub85c\uadf8\uc778 \ubabb\ud569\ub2c8\ub2e4.(vm\uc0ad\uc81c\ud574\uc57c \ud568)<br>Caution: Never block port 22. You will not be able to log in again (you will need to delete the VM).<\/p>\n\n\n\n<p>&#8212; iptables persistant\uc124\uce58(\uc14b\ud305 \uc601\uad6c\uc800\uc7a5)<br>Install iptables persistent (permanently save settings)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install iptables-persistent<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ubc29\ud654\ubcbd \uc624\ud508<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 3000\ubc88 \uc624\ud508 \/ 3000 open\nsudo iptables -I INPUT 1 -p tcp --dport 3000 -j ACCEPT\n\n# \ud655\uc778 (1\ubc88\uc5d0 \uc788\uc5b4\uc57c \ud568) \/ Check (should be at 1)\nsudo iptables -L INPUT --line-numbers -v -n\n\n# \uc601\uad6c \uc800\uc7a5 \/ Save permanently\nsudo netfilter-persistent save<\/code><\/pre>\n\n\n\n<p>\u2b50\ubc29\ud654\ubcbd \uaddc\uce59 \uc0ad\uc81c\ud558\ub824\uba74(2\ubc88\uc744 \uc0ad\uc81c\ud558\ub294 \uacbd\uc6b0)<br>To delete a firewall rule (if deleting step 2)<\/p>\n\n\n\n<p>&#8212; \uc2e4\ud589 \ud6c4 \uc6d0\ub798 2\ubc88\uc774\uc5c8\ub358 \uaddc\uce59\uc774 \uc0ac\ub77c\uc9c0\uace0, \uc544\ub798 \uaddc\uce59\ub4e4\uc774 \ud558\ub098\uc529 \uc704\ub85c \uc62c\ub77c\uc635\ub2c8\ub2e4 (3\ubc88 \u2192 2\ubc88, 4\ubc88 \u2192 3\ubc88 \u2026)<br>After execution, the original rule number 2 disappears, and the rules below move up one by one (number 3 \u2192 number 2, number 4 \u2192 number 3\u2026)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo iptables -D INPUT 2<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f\ubc29\ud654\ubcbd \uc124\uc815(\ud544\uc218\uc801\uc73c\ub85c \uc624\ud508\ud574\uc57c \ud558\ub294 \ud3ec\ud2b8)<br>Firewall settings (ports that must be opened)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 8000\ubc88 \ud3ec\ud2b8 \ud5c8\uc6a9 (\ub9e8 \uc704\uc5d0 \uc0bd\uc785)\nsudo iptables -I INPUT 1 -p tcp --dport 8000 -j ACCEPT\n\n# 443\ubc88 \ud3ec\ud2b8 \ud5c8\uc6a9 (HTTPS, \ub9e8 \uc704\uc5d0 \uc0bd\uc785 \u2192 \uc774\uc81c 1\ubc88\uc774 \ub428)\nsudo iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT\n\n# 80\ubc88 \ud3ec\ud2b8 \ud5c8\uc6a9 (HTTP, \ub9e8 \uc704\uc5d0 \uc0bd\uc785 \u2192 \uc774\uc81c 1\ubc88\uc774 \ub428)\nsudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT\n\n#3306\ubc88 \ud3ec\ud2b8\ud5c8\uc6a9 (MYSQL\ud3ec\ud2b8)\nsudo iptables -I INPUT 1 -p tcp --dport 3306 -j ACCEPT\n\n# \uc601\uad6c\uc800\uc7a5\nsudo netfilter-persistent save<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f\ucd5c\uc885 iptables\ubc29\ud654\ubcbd \uc14b\ud305 \ud655\uc778<br>Check the final iptables firewall settings<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ubuntu@app-20251223-1824:~\/dockerApp$ sudo iptables -L INPUT --line-numbers -v -n\nChain INPUT (policy ACCEPT 0 packets, 0 bytes)\nnum   pkts bytes target     prot opt in     out     source               destination\n1        9   942 ACCEPT     6    --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:3306\n2    24531 1855K ACCEPT     6    --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:22\n3        8   384 ACCEPT     6    --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:443\n4       53  2720 ACCEPT     6    --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:8000\n5       20  1338 ACCEPT     6    --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:3000\n6    34403  403M ACCEPT     0    --  *      *       0.0.0.0\/0            0.0.0.0\/0            state RELATED,ESTABLISHED\n7     1235 83838 ACCEPT     1    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n8      256 25388 ACCEPT     0    --  lo     *       0.0.0.0\/0            0.0.0.0\/0\n9        7   332 ACCEPT     6    --  *      *       0.0.0.0\/0            0.0.0.0\/0            state NEW tcp dpt:22\n10    1187 53712 REJECT     0    --  *      *       0.0.0.0\/0            0.0.0.0\/0            reject-with icmp-host-prohibited\n11       0     0 ufw-before-logging-input  0    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n12       0     0 ufw-before-input  0    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n13       0     0 ufw-after-input  0    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n14       0     0 ufw-after-logging-input  0    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n15       0     0 ufw-reject-input  0    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n16       0     0 ufw-track-input  0    --  *      *       0.0.0.0\/0            0.0.0.0\/0\n17       0     0 ACCEPT     0    --  *      *       0.0.0.0\/0            0.0.0.0\/0            state RELATED,ESTABLISHED<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0fmysql\uacc4\uc815 \ucd94\uac00 \/ Add a mysql account<\/p>\n\n\n\n<p>&#8212; root\ub85c \uc811\uc18d \/ Connect as root<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql -u root -p<\/code><\/pre>\n\n\n\n<p>&#8212; \uc0ac\uc6a9\uc790 \uacc4\uc815 \ucd94\uac00 \/ Add user account<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;\nCREATE USER 'myapp'@'%' IDENTIFIED BY 'Myapp@1234';\nGRANT ALL PRIVILEGES ON myapp.* TO 'myapp'@'%';\nFLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<p>&#8212; mysql\uc811\uc18d \ud5c8\uc6a9 \/ Allow mysql access<\/p>\n\n\n\n<p>-127.0.0.1 : MySQL\uc774 \ub85c\uceec \ub8e8\ud504\ubc31(\uc790\uae30 \uc790\uc2e0)\uc5d0\uc11c\ub9cc \uc5f0\uacb0\uc744 \ubc1b\uc544\ub4e4\uc784<br>127.0.0.1: MySQL accepts connections only on the local loopback (itself)<\/p>\n\n\n\n<p>-0.0.0.0 : \ubaa8\ub4e0 \ub124\ud2b8\uc6cc\ud06c \uc778\ud130\ud398\uc774\uc2a4\uc5d0\uc11c \uc5f0\uacb0\uc744 \ubc1b\uc544\ub4e4\uc784<br>0.0.0.0: Accept connections on all network interfaces<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/code><\/pre>\n\n\n\n<p>\uc774 \uc904\uc744 \/ Change this line<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bind-address = 127.0.0.1<\/code><\/pre>\n\n\n\n<p>\uc774\ub807\uac8c \ubc14\uafc9\ub2c8\ub2e4. \/ to this<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bind-address = 0.0.0.0<\/code><\/pre>\n\n\n\n<p>&#8212; mysql \uc7ac\uc2dc\uc791 \/ restart mysql<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart mysql<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\uc5ec\uae30\uae4c\uc9c0 \uc644\ub8cc\ud558\uba74 \ud658\uacbd\uc124\uc815\uc774 \uc644\ub8cc\ub429\ub2c8\ub2e4.<br>Once you&#8217;ve completed this, your setup is complete.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49OCI\ud658\uacbd\uc124\uc815 \/ OCI environment settings \ud83d\udc49npm init \ud588\uc744\ub54c \ub2e4\uc74c\uacfc \uac19\uc774 npm\uc774 \uc5c6\ub2e4\uba74 npm\uc124\uce58\ud569\ub2c8\ub2e4.If npm is not present when you run npm init, install npm. \ud83d\udc49nodejs \ucd5c\uc2e0\ubc84\uc804 \uc124\uce58 \/ Install the latest version of nodejs \ud83d\udc49mysql \uc124\uce58 \ud558\uae30 \/ Install mysql \u2714\ufe0f\ub2e4\uc74c\uacfc \uac19\uc740 \uba85\ub839\uc5b4\ub85c mysql\uc2e4\ud589 \uc0c1\ud0dc\ub97c \ud655\uc778 \ud569\ub2c8\ub2e4.Check the mysql execution status with the following command. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,20,1],"tags":[],"class_list":["post-3366","post","type-post","status-publish","format-standard","hentry","category-linux","category-oci","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/3366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=3366"}],"version-history":[{"count":58,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/3366\/revisions"}],"predecessor-version":[{"id":3770,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/3366\/revisions\/3770"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=3366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=3366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=3366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}