Erlang(1)Install and Introduction

本文介绍如何从源码安装Erlang并配置环境,同时详细记录了在Mac OS X上安装Yaws Web服务器的过程及遇到的问题与解决办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Erlang(1)Install and Introduction

1. Install the latest Erlang based on Sources
>wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz
Unzip the file
>tar zxvf otp_src_R16B03-1.tar.gz

>cd otp_src_R16B03-1
>export LANG=C
>./configure --prefix=/Users/carl/tool/erlang-r16b03-1
>make
>sudo make install

Check the shell version
>bin/erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] Eshell V5.10.4  (abort with ^G)

Soft link the tool directory
>sudo ln -s /Users/carl/tool/erlang-r16b03-1 /opt/erlang-5.10.4
>sudo ln -s /opt/erlang-5.10.4 /opt/erlang

>vi ~/.profile
export PATH=/opt/erlang/bin:$PATH

>. ~/.profile

Verify the Installation
>erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4

Or we can enter the erlang console
>erl

Use Control + G, q + Enter to exit the console mode.

2. Erlang Introduction
Concurrency Oriented, Message Oriented, Functional 
OTP   Open Telecom Platform

3. Build and Install Yaws
The Erlang Yaws web server performs the same basic tasks as Nginx and Apache.

Apache with mod_php, each request is handled by a process or thread. The classic Common Gateway Interface(CGI) would start a new process for every request.

These threads and processes are constructions of the OS and are relatively heavyweight objects.

In Erlang the processes are owned not by the OS, but by the language runtime.

Fetch the source codes
>git clone https://github.com/klacke/yaws.git
>cd yaws
>autoconf
-bash: autoconf: command not found

Solution:
Install autoconf
>wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
>tar xzvf autoconf-2.69.tar.gz
>cd autoconf-2.69
>./configure --prefix=/Users/carl/tool/autoconf-2.69
>make
>make install
>sudo ln -s /Users/carl/tool/autoconf-2.69 /opt/autoconf-2.69
>sudo ln -s /opt/autoconf-2.69 /opt/autoconf
Add to the PATH in .profile

Go on Install Yaws
>autoconf

But I do not know the version of the github source codes. I plan to do it from downloading the sources.

>wget http://yaws.hyber.org/download/yaws-1.98.tar.gz
>tar zxvf yaws-1.98.tar.gz
>cd yaws-1.98
>./configure --prefix=/Users/carl/tool/yaws-1.98
>make

Error Message:
gcc -c -fPIC -g -O2 -I/usr/include/security -m64 -DHAVE_SENDFILE -I"/Users/carl/tool/erlang-r16b03-1/lib/erlang/usr/include" setuid_drv.c gcc -m64 -bundle -fPIC -flat_namespace -undefined suppress -o  ../priv/lib/setuid_drv.so setuid_drv.o gcc -c -g -O2 -I/usr/include/security -m64 -DHAVE_SENDFILE -I"/Users/carl/tool/erlang-r16b03-1/lib/erlang/usr/include" epam.c epam.c:2:10: fatal error: 'pam_appl.h' file not found #include <pam_appl.h>

Solution:
http://stackoverflow.com/questions/21149481/fails-to-build-yaws-on-mac-os-x-10-9

I begin to try with this command
>sudo xcode-select —install
This command will try to install Command Lne Tools. And it will place some files we need into this directory /usr/include/security

Go on with install Yaws.
>make
>make install

After the Installation, all the info will show as follow:
** etc files went into        /Users/carl/tool/yaws-1.98/etc ** executables went into      /Users/carl/tool/yaws-1.98/bin ** library files went into    /Users/carl/tool/yaws-1.98/lib/yaws ** var files went into        /Users/carl/tool/yaws-1.98/var ** default docroot went into  /Users/carl/tool/yaws-1.98/var/yaws/www

>sudo ln -s /Users/carl/tool/yaws-1.98 /opt/yaws-1.98
>sudo ln -s /opt/yaws-1.98 /opt/yaws

Start the server
>yaws -i

or 

>yaws —daemon

How to configure it
http://yaws.hyber.org/yman.yaws?page=yaws.conf

Comments out the yaws.conf
        #<auth>        #        realm = foobar        #        dir = /        #        user = foo:bar        #        user = baz:bar        #</auth>

Visit the Server again
>sudo bin/yaws -i

And you can visit the URL http://localhost/ to access your /tmp directory.



References:
http://blog.youkuaiyun.com/xushiweizh/article/details/3466739

http://www.erlang.org/
http://www.erlang.org/doc/installation_guide/INSTALL.html

Sillycat 
http://sillycat.iteye.com/blog/1575002
http://sillycat.iteye.com/blog/1565771
http://sillycat.iteye.com/blog/2037218

https://github.com/ChicagoBoss/ChicagoBoss/wiki/Comparison-of-Erlang-Web-Frameworks
http://inaka.net/blog/2013/11/06/your-first-erlang-app-canillita/
http://www.infoq.com/cn/news/2008/06/vinoski-erlang-rest
http://wbj0110.iteye.com/blog/1984410
http://ninenines.eu/docs/en/cowboy/HEAD/guide/
http://yaws.hyber.org/

http://www.cnblogs.com/yourihua/category/329317.html

Install autoconf
http://jsdelfino.blogspot.com/2012/08/autoconf-and-automake-on-mac-os-x.html
http://www.gnu.org/software/autoconf/

http://stackoverflow.com/questions/21149481/fails-to-build-yaws-on-mac-os-x-10-9

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值