{"id":45772,"date":"2024-10-07T01:46:15","date_gmt":"2024-10-06T17:46:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/45772\/"},"modified":"2024-11-14T10:35:46","modified_gmt":"2024-11-14T02:35:46","slug":"linux-%e4%b8%8b%e5%ae%89%e8%a3%9d%e6%9c%83%e8%a8%88%e5%b7%a5%e5%85%b7-gnu-khata","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/45772\/","title":{"rendered":"Linux \u4e0b\u5b89\u88dd\u6703\u8a08\u5de5\u5177 GNU Khata"},"content":{"rendered":"<h1 id=\"linux-%e4%b8%8b%e5%ae%89%e8%a3%9d%e6%9c%83%e8%a8%88%e5%b7%a5%e5%85%b7-gnu-khata-OEDpjmfFqt\">Linux \u4e0b\u5b89\u88dd\u6703\u8a08\u5de5\u5177 GNU Khata<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u5546\u696d\u74b0\u5883\u4e2d\uff0c\u6703\u8a08\u5de5\u5177\u5c0d\u65bc\u4f01\u696d\u7684\u904b\u71df\u81f3\u95dc\u91cd\u8981\u3002GNU Khata \u662f\u4e00\u6b3e\u958b\u6e90\u7684\u6703\u8a08\u8edf\u4ef6\uff0c\u5c08\u70ba\u5c0f\u578b\u4f01\u696d\u8a2d\u8a08\uff0c\u63d0\u4f9b\u7c21\u55ae\u6613\u7528\u7684\u754c\u9762\u548c\u5f37\u5927\u7684\u529f\u80fd\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 Linux \u7cfb\u7d71\u4e0a\u5b89\u88dd GNU Khata\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u597d\u5730\u7ba1\u7406\u8ca1\u52d9\u3002<\/p>\n<h2 id=\"gnu-khata-%e7%9a%84%e7%89%b9%e9%bb%9e-OEDpjmfFqt\">GNU Khata \u7684\u7279\u9ede<\/h2>\n<ul>\n<li>\u958b\u6e90\uff1aGNU Khata \u662f\u4e00\u6b3e\u514d\u8cbb\u7684\u958b\u6e90\u8edf\u4ef6\uff0c\u4f7f\u7528\u8005\u53ef\u4ee5\u81ea\u7531\u4e0b\u8f09\u548c\u4fee\u6539\u3002<\/li>\n<li>\u591a\u8a9e\u8a00\u652f\u6301\uff1a\u652f\u6301\u591a\u7a2e\u8a9e\u8a00\uff0c\u65b9\u4fbf\u4e0d\u540c\u5730\u5340\u7684\u7528\u6236\u4f7f\u7528\u3002<\/li>\n<li>\u7c21\u55ae\u6613\u7528\uff1a\u754c\u9762\u53cb\u597d\uff0c\u9069\u5408\u6c92\u6709\u6703\u8a08\u80cc\u666f\u7684\u7528\u6236\u3002<\/li>\n<li>\u529f\u80fd\u5168\u9762\uff1a\u63d0\u4f9b\u767c\u7968\u7ba1\u7406\u3001\u5831\u8868\u751f\u6210\u3001\u5eab\u5b58\u7ba1\u7406\u7b49\u529f\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%ae%89%e8%a3%9d%e5%89%8d%e7%9a%84%e6%ba%96%e5%82%99-OEDpjmfFqt\">\u5b89\u88dd\u524d\u7684\u6e96\u5099<\/h2>\n<p>\u5728\u5b89\u88dd GNU Khata \u4e4b\u524d\uff0c\u78ba\u4fdd\u60a8\u7684 Linux \u7cfb\u7d71\u5df2\u7d93\u5b89\u88dd\u4e86\u4ee5\u4e0b\u4f9d\u8cf4\u9805\uff1a<\/p>\n<ul>\n<li>Python 3.x<\/li>\n<li>PostgreSQL<\/li>\n<li>Pip\uff08Python \u5305\u7ba1\u7406\u5de5\u5177\uff09<\/li>\n<\/ul>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88dd\u9019\u4e9b\u4f9d\u8cf4\u9805\uff1a<\/p>\n<pre><code>sudo apt update\nsudo apt install python3 python3-pip postgresql postgresql-contrib<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-gnu-khata-OEDpjmfFqt\">\u5b89\u88dd GNU Khata<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u5b89\u88dd GNU Khata\uff1a<\/p>\n<h3 id=\"1-%e4%b8%8b%e8%bc%89-gnu-khata-OEDpjmfFqt\">1. \u4e0b\u8f09 GNU Khata<\/h3>\n<p>\u9996\u5148\uff0c\u5f9e\u5b98\u65b9 GitHub \u5009\u5eab\u4e0b\u8f09 GNU Khata \u7684\u6e90\u4ee3\u78bc\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/gnu-khata\/khata.git<\/code><\/pre>\n<h3 id=\"2-%e5%89%b5%e5%bb%ba-postgresql-%e6%95%b8%e6%93%9a%e5%ba%ab-OEDpjmfFqt\">2. \u5275\u5efa PostgreSQL \u6578\u64da\u5eab<\/h3>\n<p>\u5728\u5b89\u88dd\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5275\u5efa\u4e00\u500b PostgreSQL \u6578\u64da\u5eab\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u5165 PostgreSQL \u547d\u4ee4\u884c\u754c\u9762\uff1a<\/p>\n<pre><code>sudo -u postgres psql<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5275\u5efa\u4e00\u500b\u65b0\u7684\u6578\u64da\u5eab\u548c\u7528\u6236\uff1a<\/p>\n<pre><code>CREATE DATABASE khata;\nCREATE USER khata_user WITH PASSWORD 'your_password';\nGRANT ALL PRIVILEGES ON DATABASE khata TO khata_user;<\/code><\/pre>\n<h3 id=\"3-%e5%ae%89%e8%a3%9d%e4%be%9d%e8%b3%b4%e9%a0%85-OEDpjmfFqt\">3. \u5b89\u88dd\u4f9d\u8cf4\u9805<\/h3>\n<p>\u9032\u5165 GNU Khata \u7684\u76ee\u9304\uff0c\u4e26\u5b89\u88dd\u6240\u9700\u7684 Python \u5305\uff1a<\/p>\n<pre><code>cd khata\npip3 install -r requirements.txt<\/code><\/pre>\n<h3 id=\"4-%e9%85%8d%e7%bd%ae%e6%87%89%e7%94%a8%e7%a8%8b%e5%ba%8f-OEDpjmfFqt\">4. \u914d\u7f6e\u61c9\u7528\u7a0b\u5e8f<\/h3>\n<p>\u5728 GNU Khata \u76ee\u9304\u4e2d\uff0c\u60a8\u9700\u8981\u914d\u7f6e\u6578\u64da\u5eab\u9023\u63a5\u3002\u7de8\u8f2f\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>nano khata\/settings.py<\/code><\/pre>\n<p>\u5c07\u6578\u64da\u5eab\u8a2d\u7f6e\u66f4\u6539\u70ba\u60a8\u525b\u525b\u5275\u5efa\u7684\u6578\u64da\u5eab\u548c\u7528\u6236\uff1a<\/p>\n<pre><code>DATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql',\n        'NAME': 'khata',\n        'USER': 'khata_user',\n        'PASSWORD': 'your_password',\n        'HOST': 'localhost',\n        'PORT': '',\n    }\n}<\/code><\/pre>\n<h3 id=\"5-%e9%81%8b%e8%a1%8c%e9%81%b7%e7%a7%bb-OEDpjmfFqt\">5. \u904b\u884c\u9077\u79fb<\/h3>\n<p>\u5728\u914d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u904b\u884c\u6578\u64da\u5eab\u9077\u79fb\u4ee5\u5275\u5efa\u6240\u9700\u7684\u8868\uff1a<\/p>\n<pre><code>python3 manage.py migrate<\/code><\/pre>\n<h3 id=\"6-%e5%95%9f%e5%8b%95%e6%9c%8d%e5%8b%99%e5%99%a8-OEDpjmfFqt\">6. \u555f\u52d5\u670d\u52d9\u5668<\/h3>\n<p>\u6700\u5f8c\uff0c\u555f\u52d5\u958b\u767c\u670d\u52d9\u5668\u4ee5\u904b\u884c GNU Khata\uff1a<\/p>\n<pre><code>python3 manage.py runserver 0.0.0.0:8000<\/code><\/pre>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f <a href=\"http:\/\/localhost:8000\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/localhost:8000<\/a> \u4f86\u4f7f\u7528 GNU Khata\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-OEDpjmfFqt\">\u7e3d\u7d50<\/h2>\n<p>GNU Khata \u662f\u4e00\u6b3e\u529f\u80fd\u5f37\u5927\u7684\u958b\u6e90\u6703\u8a08\u5de5\u5177\uff0c\u9069\u5408\u5c0f\u578b\u4f01\u696d\u4f7f\u7528\u3002\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5728 Linux \u7cfb\u7d71\u4e0a\u8f15\u9b06\u5b89\u88dd\u4e26\u958b\u59cb\u4f7f\u7528\u9019\u6b3e\u8edf\u4ef6\u3002\u82e5\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u4f3a\u670d\u5668\u74b0\u5883\u4f86\u904b\u884c GNU Khata\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u4ee5\u78ba\u4fdd\u60a8\u7684\u6578\u64da\u5b89\u5168\u548c\u61c9\u7528\u7a0b\u5e8f\u7684\u9ad8\u6548\u904b\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Linux \u7cfb\u7d71\u4e0a\u5b89\u88dd GNU Khata\uff0c\u8f15\u9b06\u7ba1\u7406\u6703\u8a08\uff0c\u63d0\u5347\u8ca1\u52d9\u6548\u7387\uff0c\u9069\u5408\u4e2d\u5c0f\u4f01\u696d\u4f7f\u7528\u7684\u958b\u6e90\u5de5\u5177\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-45772","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=45772"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45772\/revisions"}],"predecessor-version":[{"id":45773,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45772\/revisions\/45773"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=45772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=45772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=45772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}