CINXE.COM
How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II - Alibaba Cloud Community
<!DOCTYPE html> <html lang="en" class="sub-site-nav alicloud-header alicloud-footer"> <head> <meta charset="UTF-8"> <title>How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II - Alibaba Cloud Community</title> <link rel="shortcut icon" href="https://img.alicdn.com/tfs/TB1ugg7M9zqK1RjSZPxXXc4tVXa-32-32.png" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="keywords" content="Tech Share,Marketplace,Serverless,Function Compute,App Dev,OpenWhisk" /> <meta name="description" content="This tutorial aims at detailing the installation process of Apache OpenWhisk onto an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 18."> <meta name="csrf-param" content="yunqi_csrf"/> <meta name="csrf-token" content="B7W35W2LPZ"/> <meta name="data-spm" content="a2c65"> <meta name="aplus-rhost-v" content="sg.mmstat.com"> <meta name="aplus-rhost-g" content="sg.mmstat.com"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" type="text/css" href="//g.alicdn.com/??alicloud-components/alicloud-ui3/0.0.7/acUI.css,alicloud-components/acApp/0.0.3/app.css,alicloud-components/i18n/0.0.29/css/en-us/index.css,alicloud-components/iconfont/0.0.7/product-icon.css"> <link rel="stylesheet" type="text/css" href="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/css/detail.css"> <link rel="stylesheet" type="text/css" href="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/css/nav.css"> <link rel="stylesheet" type="text/css" href="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/fonts/iconfont.css"> <link rel="stylesheet" type="text/css" href="https://g.alicdn.com/ali-mod/b-alicloud-v3-bottom/0.0.19/index.css"> <link rel="stylesheet" type="text/css" href="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/fonts/iconfont.css"> <meta property="og:url" content="https://www.alibabacloud.com/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685"> <meta property="og:site_name" content="Alibaba Cloud Community"> <meta property="og:title" content="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <meta property="og:description" content="This tutorial aims at detailing the installation process of Apache OpenWhisk onto an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 18."> <meta property="og:image" content="https://yqintl.alicdn.com/3ca87ae47153857ed811d60e1224f000f09bbf59.jpeg"> <meta property="og:image:type" content="image/png"> <meta property="twitter:creator" content="Alibaba Cloud Community"> <meta property="twitter:card" content="summary_large_image"> <meta property="twitter:title" content="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <meta property="twitter:description" content="This tutorial aims at detailing the installation process of Apache OpenWhisk onto an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 18."> <meta property="twitter:image:src" content="https://yqintl.alicdn.com/3ca87ae47153857ed811d60e1224f000f09bbf59.jpeg"> <script src="//g.alicdn.com/??alicloud-components/kloud/0.0.31/vendor/requirejs/require.js,alicloud-components/kloud/0.0.1/scripts/vendor/jquery/jquery.min.js,alicloud-components/common/scripts/layout.js,alicloud-components/alicloud-ui3/0.0.7/acUI.js"></script> <script src="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/js/layout.js"></script> </head> <body data-spm="11461447"><script type="text/javascript"> (function (d) { var t=d.createElement("script");t.type="text/javascript";t.async=true;t.id="tb-beacon-aplus"; t.setAttribute("exparams","category=&userid=&aplus&yunid=&yunpk=&channel=&cps="); t.src="//g.alicdn.com/alilog/mlog/aplus_v2.js"; d.getElementsByTagName("head")[0].appendChild(t); })(document); </script> <div class="blog-nav"> <div class="container"> <div class="row"> <h1> Community </h1> <main class="blog-nav-center"> <a href="https://www.alibabacloud.com/blog/" class="bg"> Blog </a> <a href="https://resource.alibabacloud.com/event/index"> Events </a> <a href="https://resource.alibabacloud.com/webinar/index.htm"> Webinars </a> <a href="https://community.alibabacloud.com/tags/type_blog-tagid_28404/"> Tutorials </a> <a href="https://www.alibabacloud.com/forum"> Forum </a> </main> <ul class="blog-nav-right"> <li class="search"><input type="text" placeholder="Search" id="search"> <i class="search-btn k-iconfont icon-sousuo1"></i> <div class="close-box"><img data-original="https://img.alicdn.com/tfs/TB1BIBBsbPpK1RjSZFFXXa5PpXa-24-24.png" data-toggle="lazy-loading" class="off" /><img data-original="https://img.alicdn.com/tfs/TB1vrJ2shnaK1RjSZFBXXcW7VXa-24-24.png" data-toggle="lazy-loading" class="on" /></div> </li> </ul> <div class="blog-nav-right-m"> <i class="k-iconfont icon-sousuo1 show-search"></i> <i class="show-more"></i> </div> </div> <div class="blog-nav-main-m"> <ol> <li><a href="https://community.alibabacloud.com">Blog</a></li> <li> <a href="https://resource.alibabacloud.com/event/index"> Events </a> </li> <li> <a href="https://resource.alibabacloud.com/webinar/index.htm"> Webinars </a> </li> <li> <a href="https://www.alibabacloud.com/getting-started/projects"> Tutorials </a> </li> <li> <a href="https://www.alibabacloud.com/forum"> Forum </a> </li> </ol> <div class="btn-box"> <a href="https://account.alibabacloud.com/register/register.htm?from_type=yqclub&oauth_callback=https%3A%2F%2Fwww.alibabacloud.com%2Fblog%2Fhow-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685%3Fdo%3Dlogin" class="free" style="display: block;"> Create Account </a> <a href="https://account.alibabacloud.com/login/login.htm?from_type=yqclub&oauth_callback=https%3A%2F%2Fwww.alibabacloud.com%2Fblog%2Fhow-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685%3Fdo%3Dlogin" class="login" style="display: block;"> Log In </a> </div> </div> <div class="container blog-nav-search-m"> <div class="blog-nav-search-m-top"> <input type="text" placeholder="Search" class="int-search"> <button> <i class="k-iconfont icon-sousuo1"></i> </button> <span> × </span> </div> </div> </div> </div> <div class="wrap container"> <div class="wrap-top"> <a href="https://community.alibabacloud.com">Community</a> <i class="icon icon-more"></i> <a href="https://www.alibabacloud.com/blog/">Blog</a> <i class="icon icon-more"></i> How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II </div> <div class="wrap-main"> <div class="col-md-8"> <div class="wrap-main-left"> <h1> How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II </h1> <aside> <main> <a href="https://community.alibabacloud.com/users/5040995529404844">Alibaba Clouder</a> <span>April 12, 2019</span> <span> <img src="https://img.alicdn.com/tfs/TB19L9AbXuWBuNjSspnXXX1NVXa-40-26.png" alt=""> 33,594 </span> <a href="#comment"> <i class="icon icon-pinglun"></i><b class="comments-num">0</b> </a> </main> <div> </div> </aside> <div class="wrap-main-left-abstract"> This tutorial aims at detailing the installation process of Apache OpenWhisk onto an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 18. </div> <div class="wrap-main-left-article markdown-body"> <p><em>By Sai Sarath Chandra, <a href="https://www.alibabacloud.com/campaign/techshare">Alibaba Cloud Tech Share</a> Author. <a href="https://www.alibabacloud.com/campaign/techshare">Tech Share</a> is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.</em></p> <p><a href="https://www.alibabacloud.com/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-i_594683?spm=a2c65.11461433.0.0.77985355Q7Q4Gm" target="_blank">In the previous article</a>, we have set up our Elastic Compute Service (ECS) instance and configured it with Docker. Now, we need to install CouchDB on the system and complete the OpenWhisk installation.</p> <h2>What Is Couch DB?</h2> <p>CouchDB is one of many offerings available in the NoSQL space and is a document-based database. All the data is stored in the JSON documents as a key value pairs as a map. The unique feature of CouchDB is there is also a _rev(revision) along with _id(Unique identifier) shows how many changes are made.</p> <p>The advantage of CouchDB over other NoSql offerings are</p> <ul> <li>CouchDB is constructed in such a way that, it can grow easily into a cluster depends upon your needs</li> <li>CouchDB also has an in-built managed cache, which is responsible for fast responses</li> <li>You can also listen to the _changes(changes) feed to keep tracking of changes which are made.</li> </ul> <h2>Installing CouchDB</h2> <p>Adding the CouchDB GPG key to the keyring, by executing following command</p> <pre><code>~root@iZa2d4spx9n9e90jofcyxoZ:~# curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | apt-key add -</code></pre> <p>You will get the output similar to this</p> <pre><code> % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 100 3100 100 3100 0 0 1429 0 0:00:02 0:00:02 --:--:-- 1429 OK</code></pre> <p>Adding the repository to the sources</p> <pre><code>~root@iZa2d4spx9n9e90jofcyxoZ:~# echo "deb https://apache.bintray.com/couchdb-deb bionic main" | tee -a /etc/apt/sources.list</code></pre> <p>Updating the apt system</p> <pre><code>~root@iZa2d4spx9n9e90jofcyxoZ:~# sudo apt-get update</code></pre> <p>Install the CouchDB using the command here:</p> <pre><code>~root@iZa2d4spx9n9e90jofcyxoZ:~# apt-get install -y couchdb</code></pre> <p>While installing the CouchDB you will get the following screens for some information. The first screen asking for which type of installation is preferred, I chose standalone since we are prototyping</p> <p><img src="https://yqintl.alicdn.com/f03bba07d5b147623e9565677b6d58472089bdcf.png" alt="1" title="1"></p> <p>In next screen it will ask for the binding IP, like below. Choose 0.0.0.0</p> <p><img src="https://yqintl.alicdn.com/def14983be06ec10d92e6e853756e3e9cdcc6ad3.png" alt="2" title="2"></p> <p>Then the admin password, the username by default is "admin". You can change this account and password later, but it is important to have those details here</p> <p><img src="https://yqintl.alicdn.com/185aa8d36eb767c480cb03eb77835d4e89c05d81.png" alt="3" title="3"></p> <p>Repeat the password</p> <p><img src="https://yqintl.alicdn.com/db1bc9a348a795bca23e8e6b8260d5960b5fd222.png" alt="4" title="4"></p> <p>Once you confirm the password, the installation resumes and all the dependencies will be installed.</p> <p>You can check the service status of the couch DB using the command below</p> <pre><code>~root@iZa2d4spx9n9e90jofcyxoZ:~# sudo service couchdb status</code></pre> <p>The command gives an output similar to this showing the running state as active</p> <pre><code>couchdb.service - Apache CouchDB[m Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled) Active: active (running) since Sat CST; 28s ago Main PID: 27987 (beam.smp) Tasks: 27 (limit: 4915) CGroup: /system.slice/coucdb.service ├─27987 /opt/couchdb/bin/../erts-8.3.5.4/bin/beam.smp -K true -A 16 -Bd -- -root /opt/couchdb/bin/.. -progname couchdb -- -home /opt/couchdb -- -boot /opt ├─27997 /opt/couchdb/bin/../erts-8.3.5.4/bin/epmd -daemon ├─28028 erl_child_setup 1024 ├─28036 sh -s disksup ├─28037 /opt/couchdb/bin/../lib/os_mon-2.4.2/priv/bin/memsup └─28038 /opt/couchdb/bin/../lib/os_mon-2.4.2/priv/bin/cpu_sup</code></pre> <p>One of the big features of CouchDB is the availability of REST API. If you run the following command, you should see all the information in a JSON format. This confirms that the API is up and running on the server</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~# curl http://127.0.0.1:5984/ {"couchdb":"Welcome","version":"2.2.0","git_sha":"2a16ec4","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}</code></pre> <p>Now, we will access fauxton which is installed as part of the CouchDB to make some configuration changes</p> <p>The fauxton will be running in the same port as the CouchDB, headover to the browser and hit <a href="https://www.alibabacloud.com/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-i_594683?spm=a2c65.11461433.0.0.77985355Q7Q4Gm" target="_blank">http://:5984</a> and you will see a login screen</p> <p><img src="https://yqintl.alicdn.com/6dccede70316163caffbefd87a4028ad885ab3e7.png" alt="5" title="5"></p> <p>Login with your credentials created while installing the CouchDB, once you are logged in CouchDB will setup a default system database with all the relevant details, where we can manage users, replicators, global variables etc..</p> <p><img src="https://yqintl.alicdn.com/bf9c4d71cc45f2b7caaaad38f65052f693bfd311.png" alt="6" title="6"></p> <p>You can also change the credentials, create new users and the IP Address binding for each specific user right from the web console</p> <p><img src="https://yqintl.alicdn.com/7bba74ba313169504251a0490aa6dcd59d6d5bec.png" alt="7" title="7"></p> <p>Here I am creating the user "admin1" default to the same port and the IP address and click on "Configure Node". That will take of creating the database in the background. Apache Openwhisk strongly recommends to change the "reduce_limit" property value of the CouchDB to false.</p> <p><img src="https://yqintl.alicdn.com/9c09fdf2c160662c40b2adba7558413857b72469.png" alt="8" title="8"></p> <p>You will find it under the console > settings > "query_server_config" > reduce_limit change it to "false" by clicking on that. Once you click save you will see the prompt after the successful update like below</p> <p><img src="https://yqintl.alicdn.com/6b5ff3ebf7c8bf8b2e03eddc69a4f0e09d765fdc.png" alt="9" title="9"></p> <p>Once you have done this, you can also do the same using the standard REST API. To see what are all the users available. You can run the following command</p> <pre><code>curl http://127.0.0.1:5984/_all_dbs {"error":"unauthorized","reason":"You are not a server admin."}</code></pre> <p>The error is common you need to authenticate the user when invoking the REST API. This can be fixed by adding a user authentication while making the call.</p> <pre><code>curl http://admin:password@127.0.0.1:5984/_all_dbs ["_global_changes","_replicator","_users"]</code></pre> <p>If you wish to see the "_global_changes" DB realted information you will do so by</p> <pre><code>curl http://admin:password@127.0.0.1:5984/_global_changes {"db_name":"_global_changes","update_seq":"4-g1AAAAFTeJzLYWBg4MhgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUoxJTIkyf___z8rkQGPoiQFIJlkD1bHiE-dA0hdPGHzEkDq6gmal8cCJBkagBRQ6Xz8ZkLULoCo3U-M2gMQtfeJUfsAohboXqYsANYbbzI","sizes":{"file":13699,"external":16,"active":860},"purge_seq":0,"other":{"data_size":16},"doc_del_count":0,"doc_count":4,"disk_size":13699,"disk_format_version":6,"data_size":860,"compact_running":false,"cluster":{"q":8,"n":1,"w":1,"r":1},"instance_start_time":"0"}</code></pre> <h2>Install OpenWhisk</h2> <p>Now we have completed the setup of CouchDB, we will install the Apache OpenWhisk. </p> <p>We need to clone the git repository. The below command will clone the code into the openwhisk folder.</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~# git clone https://github.com/apache/incubator-openwhisk.git openwhisk</code></pre> <p>Change to openwhisk directory and run the scripts.</p> <pre><code>~root@iZa2d4spx9n9e90jofcyxoZ:~# cd openwhisk/</code></pre> <p>Run the scripts, with sudo, as these scripts invoke sudo as part of their process</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk# (cd tools/ubuntu-setup && ./all.sh) + JAVA_SOURCE=open + SOURCE=./all.sh ++ dirname ./all.sh + SCRIPTDIR=. + echo '*** installing basics' *** installing basics + /bin/bash ./misc.sh + export DEBIAN_FRONTEND=noninteractive + DEBIAN_FRONTEND=noninteractive</code></pre> <p>You can see as above the script is running and it will take a while, keep track on the console, whether the installation is successful or any warnings popped up. If your installation is successful, you will see the below output at the end.</p> <pre><code>docker-ce is already the newest version (5:18.09.0~3-0~ubuntu-bionic). 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. + sudo -E bash -c 'echo '\''DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --storage-driver=aufs"'\'' >> /etc/default/docker' ++ whoami + sudo gpasswd -a root docker Adding user root to group docker + sudo service docker restart</code></pre> <p>Now, it's time to run some ansible scripts, the scripts are generated under the ansible folder under openwhisk, change to ansible directory</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk# cd ansible</code></pre> <p>Export all the DB parameters, the DB IP should be accessible from outside the Virtual Machine</p> <pre><code>export OW_DB=CouchDB root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# export OW_DB_PROTOCOL=http root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# export OW_DB_HOST=<public IP> root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# export OW_DB_PORT=5984 root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# export OW_DB_USERNAME=admin root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# export OW_DB_PASSWORD=password</code></pre> <p>Apache Openwhisk team does a great job in providing the scripts for the complex installation, when we run the setup.yml it will generate all the config files</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook setup.yml</code></pre> <pre><code>Gathering Facts -------------------- 0.81s gen hosts if 'local' env is used --- 0.48s generate invoker certificates ------ 0.48s generate controller certificates --- 0.47s ensure controller files directory exists ----- 0.46s gen untrusted client certificate for host ---- 0.41s ensure invoker files directory exists -------- 0.38s gen untrusted server certificate for host ---- 0.37s prepare db_local.ini --------------- 0.32s check if db_local.ini exists? ------ 0.18s ensure kafka files directory exists 0.04s get the docker-machine ip ---------- 0.04s gen hosts for docker-machine ------- 0.03s clean up old kafka keystore -------- 0.03s generate kafka certificates -------- 0.03s find the ip of docker-machine ------ 0.03s</code></pre> <p>Install the prerequsites on all the openwhisk nodes</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook prereq.yml</code></pre> <pre><code>Gathering Facts ------------------------ 0.78s prereq : install docker for python ----- 0.66s prereq : install requests -------------- 0.64s prereq : install httplib2 -------------- 0.64s Gathering Facts ------------------------ 0.55s Gathering Facts ------------------------ 0.55s Gathering Facts ------------------------ 0.55s prereq : check for pip ----------------- 0.44s prereq : install pip ------------------- 0.03s prereq : remove docker ----------------- 0.03s prereq : remove requests --------------- 0.03s prereq : remove httplib2 --------------- 0.02s</code></pre> <p>Build and distribute the docker images using docker, make sure you move to the openwhisk root repository</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk# ./gradlew distDocker</code></pre> <p>Deploying CouchDB and openwhisk deployment</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook initdb.yml root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook wipe.yml root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook openwhisk.yml root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook postdeploy.yml</code></pre> <p>Now you can find the docker process by running the following command,</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# docker ps</code></pre> <p>You will see all the nodes are running with different workloads on them</p> <pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 73c17753ad74 nginx:1.13 "nginx -g 'daemon of…" 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8443->8443/tcp nginx b51d882d6295 openwhisk/nodejs6action:latest "/bin/sh -c 'node --…" 2 minutes ago Up 2 minutes wsk00_4_prewarm_nodejs6 cb6d90d7fce5 openwhisk/nodejs6action:latest "/bin/sh -c 'node --…" 2 minutes ago Up 2 minutes wsk00_2_prewarm_nodejs6 e83e0a8ff8a3 whisk/invoker:latest "/bin/sh -c 'exec /i…" 2 minutes ago Up 2 minutes 0.0.0.0:17000->17000/tcp, 0.0.0.0:18000->18000/tcp, 0.0.0.0:12001->8080/tcp invoker0 3f1287e56e07 whisk/controller:latest "/bin/sh -c 'exec /i…" 10 minutes ago Up 10 minutes 0.0.0.0:15000->15000/tcp, 0.0.0.0:16000->16000/tcp, 0.0.0.0:8000->2551/tcp, 0.0.0.0:10001->8080/tcp controller0 e4f4b8a35182 wurstmeister/kafka:0.11.0.1 "start-kafka.sh" 10 minutes ago Up 10 minutes 0.0.0.0:9072->9072/tcp, 0.0.0.0:9093->9093/tcp kafka0 db10c72113e4 zookeeper:3.4 "/docker-entrypoint.…" 10 minutes ago Up 10 minutes 0.0.0.0:2181->2181/tcp, 0.0.0.0:2888->2888/tcp, 0.0.0.0:3888->3888/tcp zookeeper0 71df5847d252 redis:3.2 "docker-entrypoint.s…" 22 minutes ago Up 22 minutes 0.0.0.0:6379->6379/tcp redis</code></pre> <p>You can see all the relevant dependencies nginx, nodejs6, kafka, redis, zookeeper working on different docker containers</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/ansible# ansible-playbook -i environments/local openwhisk.yml</code></pre> <p>Change to binaries of the openwhisk directory, and add the tool to the path</p> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/bin# export PATH=$PATH:$PWD</code></pre> <pre><code>root@iZa2d4spx9n9e90jofcyxoZ:~/openwhisk/bin# wsk ____ ___ _ _ _ _ _ /\ \ / _ \ _ __ ___ _ __ | | | | |__ (_)___| | __ /\ /__\ \ | | | | '_ \ / _ \ '_ \| | | | '_ \| / __| |/ / / \____ \ / | |_| | |_) | __/ | | | |/\| | | | | \__ \ < \ \ / \/ \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\ \___\/ tm |_|</code></pre> <p>You will be able to see the openwhisk after the successful installation like above message</p> <p>Create file hello.js and update with the file</p> <pre><code>sudo nano hello.js</code></pre> <p>Then, copy the below code</p> <pre><code>/** * Hello world as an OpenWhisk action. */ function main(params) { var name = params.name || 'World'; return {payload: 'Hello, ' + name + '!'}; }</code></pre> <p>Create an action named 'hello' using the command line tool</p> <pre><code>wsk action create hello hello.js</code></pre> <p>You can invoke the action using this, add -i for disabling authentication</p> <pre><code>wsk action invoke hello --result</code></pre> <pre><code>{ "payload": "Hello, World!" }</code></pre> <p>Congratulations! It means Apache OpenWhisk is installed on your Ubuntu machine and operational. You can learn about working on Apache OpenWhisk here: <a href="https://github.com/apache/incubator-openwhisk" target="_blank">https://github.com/apache/incubator-openwhisk</a></p> </div> <div class="wrap-main-left-bar"> <span><a href="https://community.alibabacloud.com/tags/type_blog-tagid_23892/">Tech Share</a></span> <span><a href="https://community.alibabacloud.com/tags/type_blog-tagid_26437/">Marketplace</a></span> <span><a href="https://community.alibabacloud.com/tags/type_blog-tagid_27937/">Serverless</a></span> <span><a href="https://community.alibabacloud.com/tags/type_blog-tagid_27963/">Function Compute</a></span> <span><a href="https://community.alibabacloud.com/tags/type_blog-tagid_28241/">App Dev</a></span> <span><a href="https://community.alibabacloud.com/tags/type_blog-tagid_28980/">OpenWhisk</a></span> </div> <div class="wrap-main-left-action"> <main> <a href="#comment"> <i class="icon icon-pinglun"></i> 0 </a> <span class="action-zan" data-islogin="false" data-id="594685" data-already="false" rel="nofollow"> <i class="icon icon-zan"></i> <b>0</b> </span> <span class="action-love" data-islogin="false" data-id="594685" data-already="false" rel="nofollow"> <i class="icon icon-love"></i> <b>0</b> </span> </main> <div> <b>Share on</b> <a href="javascript:;" class="sharer" data-sharer="linkedin" data-url="" title="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <i class="icon icon-linkedin1"></i> </a> <a href="javascript:;" class="sharer" data-sharer="facebook" data-url="" title="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <i class="icon icon-lianshu1"></i> </a> <a href="javascript:;" class="sharer" data-sharer="twitter" data-url="" title="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <i class="icon icon-twitter1"></i> </a> </div> </div> <div class="wrap-main-left-read"> <main> <h2> Read previous post: </h2> <p> <a href="/blog/how-to-set-up-cms-made-simple-v2-2-lamp-in-centos-7-3_594684"> How to Set Up CMS Made Simple v2.2 (LAMP in CentOS 7.3) </a> </p> </main> <main> <h2> Read next post: </h2> <p> <a href="/blog/alibaba-cloud-quickbi-demo-analyzing-us-census-bureau-data-set_594686"> Alibaba Cloud QuickBI Demo: Analyzing US Census Bureau Data Set </a> </p> </main> </div> <div class="wrap-main-right-user wrap-main-right-user-mobile"> <dl> <dt> <a href="https://community.alibabacloud.com/users/5040995529404844"> <img src="https://yqintl.alicdn.com/img_572d495de1d399a4388a7656634ed8c7.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt=""> </a> </dt> <dd> <h1> <a href="https://community.alibabacloud.com/users/5040995529404844"> Alibaba Clouder </a> </h1> <p> 2,599 posts | 769 followers </p> <a href="#" class="follow-btn" data-islogin="false" data-uid="5040995529404844" data-isfollowed="false" id="follow-btn" rel="nofollow">Follow</a> </dd> </dl> </div> <h3> You may also like </h3> <ul class="wrap-main-left-list"> <li> <span></span> <a href="/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-i_594683"> How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part I </a> <p> Alibaba Clouder - April 12, 2019 </p> </li> <li> <span></span> <a href="/blog/tutorial-about-setting-up-server-manager-on-ubuntu-18-04_596260"> Tutorial about Setting Up Server Manager on Ubuntu 18.04 </a> <p> Alibaba Clouder - June 3, 2020 </p> </li> <li> <span></span> <a href="/blog/serverless-engineering-practices-%7C-the-self-built-apache-openwhisk-platform_598624"> Serverless Engineering Practices | The Self-Built Apache OpenWhisk Platform </a> <p> Alibaba Cloud Serverless - February 22, 2022 </p> </li> <li> <span></span> <a href="/blog/how-to-set-up-disk-quota-on-ubuntu-18-04-server_595877"> How to Set Up Disk Quota on Ubuntu 18.04 server </a> <p> francisndungu - February 24, 2020 </p> </li> <li> <span></span> <a href="/blog/how-to-speed-up-apache-with-varnish-cache-on-ubuntu-18-04_595878"> How to Speed Up Apache with Varnish Cache on Ubuntu 18.04 </a> <p> francisndungu - February 24, 2020 </p> </li> <li> <span></span> <a href="/blog/how-to-set-up-memcached-with-php-on-ubuntu-18-04_595628"> How to Set Up Memcached with PHP on Ubuntu 18.04 </a> <p> francisndungu - December 10, 2019 </p> </li> </ul> <h3 id="comment"> Comments </h3> <div class="wrap-main-left-comments"> <span class="hidden" id="pageCount" data-pageCount="0"></span> </div> <div class="page parent-page"></div> <div class="write-comments"> <textarea name="" id="" cols="30" rows="10" placeholder="Write your comment..."></textarea> <div class="write-comments-btn"> <button class="btn btn-primary add-parent-comment">Post</button> </div> </div> </div> <div class="wrap-main-iconBox"> <a href="javascript:;" class="bg sharer" data-sharer="linkedin" data-url="https://www.alibabacloud.com/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685" title="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <i class="icon icon-linkedin1"></i> </a> <a href="javascript:;" class="sharer" data-sharer="facebook" data-url="https://www.alibabacloud.com/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685" title="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <i class="icon icon-lianshu1"></i> </a> <a href="javascript:;" class="sharer" data-sharer="twitter" data-url="https://www.alibabacloud.com/blog/how-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685" title="How to Set Up Apache OpenWhisk on Ubuntu 18.04 – Part II"> <i class="icon icon-twitter1"></i> </a> </div> </div> <div class="wrap-main-right col-md-4"> <div class="wrap-main-right-user wrap-main-right-user-pc"> <dl> <dt> <a href="https://community.alibabacloud.com/users/5040995529404844"> <img src="https://yqintl.alicdn.com/img_572d495de1d399a4388a7656634ed8c7.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt=""> </a> </dt> <dd> <h1> <a href="https://community.alibabacloud.com/users/5040995529404844"> Alibaba Clouder </a> </h1> <p> 2,599 posts | <span class="followers-num">769</span> followers </p> <a href="#" class="follow-btn" data-islogin="false" data-uid="5040995529404844" data-isfollowed="false" id="follow-btn" rel="nofollow">Follow</a> </dd> </dl> </div> <div class="wrap-main-right-box"> <h1> Related Products </h1> <ul> <li> <h2> <a href="https://community.alibabacloud.com/go/1/217"> <img src="https://yqintl.alicdn.com/img_0b6ca7ef2b9167ea358345c15f24b1a0.png" alt=""> Function Compute </a> </h2> <p> Alibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers. </p> <a href="https://community.alibabacloud.com/go/1/217" class="btn btn-default"> Learn More </a> </li> <li> <h2> <a href="https://community.alibabacloud.com/go/1/165"> <img src="https://yqintl.alicdn.com/img_f0f5dd2daa064a3fde27a57b680302c2.png" alt=""> OSS(Object Storage Service) </a> </h2> <p> An encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world </p> <a href="https://community.alibabacloud.com/go/1/165" class="btn btn-default"> Learn More </a> </li> <li> <h2> <a href="https://community.alibabacloud.com/go/1/253"> <img src="https://yqintl.alicdn.com/img_5ecfa58d5012ab477468ffa21327e848.png" alt=""> Marketplace </a> </h2> <p> Marketplace is an online market for users to search and quickly use the software as image for Alibaba Cloud products. </p> <a href="https://community.alibabacloud.com/go/1/253" class="btn btn-default"> Learn More </a> </li> </ul> </div> <div class="wrap-main-right-list"> <div> <p> <b> More Posts </b> <span> by Alibaba Clouder </span> </p> <main> <span> <a href="https://community.alibabacloud.com/users/5040995529404844/article">See All</a> </span> <i class="icon icon-more"></i> </main> </div> <ul> <li> <a href="/blog/mybatis-with-a-more-fluent-experience_598062">MyBatis with a More Fluent Experience</a> </li> <li> <a href="/blog/alibaba-cloud-sustainability-report-2021_598055">Alibaba Cloud Sustainability Report 2021</a> </li> <li> <a href="/blog/comparing-cni-models-in-container-service-for-kubernetes-%E2%80%94-alibaba-cloud-series-part-1_598052">Comparing CNI Models in Container Service for Kubernetes — Alibaba Cloud Series Part 1</a> </li> <li> <a href="/blog/infographic-5-steps-to-accelerate-your-digitalization-in-asia_598049">[Infographic] 5 Steps to Accelerate Your Digitalization in Asia</a> </li> <li> <a href="/blog/attackers-use-the-vulnerability-of-showdoc-to-spread-botnets_598047">Attackers Use the Vulnerability of ShowDoc to Spread Botnets</a> </li> <li> <a href="/blog/powerful-mybatis-and-three-streaming-query-methods_598037">Powerful: MyBatis and Three Streaming Query Methods</a> </li> <li> <a href="/blog/what-is-the-difference-between-spring-boot-and-spring_598036">What is the Difference between Spring Boot and Spring?</a> </li> <li> <a href="/blog/what-are-the-differences-and-functions-of-the-redo-log-undo-log-and-binlog-in-mysql_598035">What are the Differences and Functions of the Redo Log, Undo Log, and Binlog in MySQL?</a> </li> <li> <a href="/blog/on-the-in-depth-cluster-scheduling-and-management_598012">On the In-Depth Cluster Scheduling and Management</a> </li> <li> <a href="/blog/alibaba-technological-practices-experiences-in-cloud-resource-scheduling_598011">Alibaba Technological Practices: Experiences in Cloud Resource Scheduling</a> </li> </ul> </div> </div> </div> </div> <script type="text/javascript" nonce="J9AIW9YODE"> window.localconfigs = { 'aid': 594685 }; </script> <script type="text/javascript" nonce="J9AIW9YODE"> window.configs = { "csrf-param": "yunqi_csrf", "csrf-token": "B7W35W2LPZ", "islogin": false, "registerurl": "https://account.alibabacloud.com/register/register.htm?from_type=yqclub&oauth_callback=https%3A%2F%2Fwww.alibabacloud.com%2Fblog%2Fhow-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685%3Fdo%3Dlogin", "loginurl": "https://account.alibabacloud.com/login/login.htm?from_type=yqclub&oauth_callback=https%3A%2F%2Fwww.alibabacloud.com%2Fblog%2Fhow-to-set-up-apache-openwhisk-on-ubuntu-18-04-part-ii_594685%3Fdo%3Dlogin", "isNeedNickname": false, "baseurl": "/blog" }; </script> <script src="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/js/detail.js"></script> <script src="//g.alicdn.com/aliyun-international/blog-assert/0.0.23/js/nav.js"></script> <script type="text/javascript" nonce="J9AIW9YODE"> (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-86123020-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>